Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT Jpanel allignment
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


raveen
Jpanel allignment
2 Answer(s)      a year and 9 months ago
Posted in : Swing AWT


i have two panels added one below anotehr. and i have a one button. when i clicked button. the first panel ara should be overlapped with second panel. i mean second panel size should cover both paenls size using gribaglayout or any layout. need quick reply.

thanks in advance.


Advertisement
View Answers

January 11, 2013 at 5:49 PM


hi friend, To align the panels you would have to set size manually or you can use java.awt.Insets to set the preferred size and to overlap the panels you can use javax.swing.JLayeredPane class.

for example

JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setBounds(0, 0, 600, 400);
Frame frame = new JFrame();
frame.add(layeredPane, BorderLayout.CENTER);       
JPanel panel = new JPanel();        
panel.setBounds(50, 10, 150, 150);

layeredPane.add(panel, new Integer(0), 0);


January 11, 2013 at 6:49 PM


hi friend,

Go through the link Roseindia Tutorial

this may helpful for you.



Related Tutorials/Questions & Answers:
Jpanel allignment
Jpanel allignment  i have two panels added one below anotehr. and i have a one button. when i clicked button. the first panel ara should be overlapped with second panel. i mean second panel size should cover both paenls size
scrollbar in JPanel
f = new Frame ("Demo");JPanel p = new JPanel();JButton b1 = new...) { Frame f = new Frame ("Demo"); JPanel p = new JPanel(); JButton b1 = new JButton
Advertisements
Scroll in JPanel
static void main(String[] args) { Frame f = new Frame ("Demo"); JPanel p = new JPanel(); JButton b1 = new JButton("Button 1"); JButton b2 = new JButton("Button 2
Allignment Issue - Java Server Faces Questions
Allignment Issue  I have a jsf page with many tabs(with sub tabs) and a selectOneListbox. When I move the mouse over any tabs(ie; when the subtabs become visible) the selectOneListbox's height is shown extended. And within
How to add JTable in JPanel
How to add JTable in JPanel  How to add JTable in JPanel
Draw bufferimage in jpanel using netbeans
Draw bufferimage in jpanel using netbeans  please i need urgent help. i have form which contains some fields generated in netbeans. how can i draw bufferimage in Jpanel that is inside the form. thanks
How to draw in jPanel? swing/graphics Java
How to draw in jPanel? swing/graphics Java  How to draw in jPanel? (swing/graphics Java
Draw a line in a JPanel with button click in Java
Draw a line in a JPanel with button click in Java  Draw a line in a JPanel with button click in Java
How to save JPanel as gif or jpeg file
How to save JPanel as gif or jpeg file  i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want save the data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
Display Multiple Images in jscrollpane using Java Jpanel
Display Multiple Images in jscrollpane using Java Jpanel  Browse and Display multiple images in vertical view of java jscrollpane using jpanel
resize image with the change in size of jpanel.. - Java Beginners
resize image with the change in size of jpanel..  hi.. i am try to insert image in jpanel in jform to give attractive look to application,but the of image do not changes if the size of jframe or jpanel changes. if there is any
How to save JPanel as gif or jpeg file
How to save JPanel as gif or jpeg file  i draw polygons , rectangles, lines on jpanel using draw line method drawpolygon methods etc, now i want save the data of jpanel which is drawn by me(lines,polygons) as a gif or jpeg file
How to Add JComboBox on JPanel - Java Beginners
How to Add JComboBox on JPanel  How to Add JComboBox on JPanel D:\java>javac ViewElements.java ViewElements.java:181: expected jc.addItem("France"); ^ ViewElements.java:182: expected
Displaying the same image in a JPanel and using scroll - HELP - Java Beginners
Displaying the same image in a JPanel and using scroll - HELP  I hope someone can help me out here. I want to display an image in a JPanel which... taken up by graphics private JPanel drawingPane; private JLabel label; private
How to Set Transperent Background Image to Jpanel - Java Beginners
How to Set Transperent Background Image to Jpanel  Sir ,How to set Background Image to Jpanel.  Hi Friend, Try the following code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public
Scrollpane in Java Swing
which extends the class JPanel. The method setSize() resizes the component
java swings - Java Beginners
java swings   Do you want to add textfields on the JPanel
Press button and Scroll Image to Scrollpanel
Press button and Scroll Image to Scrollpanel  Insert image into the jpanel,inside the jscrollpane.If i press the button and scroll image
question
question  Good Afternoon, code to display the employees on leave,and approve that leave for manager.using JPanel+mysql+Java
JComboBox on JRadioButton - Java Beginners
JComboBox on JRadioButton  How to add JComboBox on Jpanel ,Give Me Sample Code
loading image - Swing AWT
loading image  give me a source code to add any wallpaer of my PC as a background image to jpanel on a jframe
Mr
; private JLabel labV1; private JPanel contentPane; //----- private JPanel pnlCenterBoxLayout; //----- private JButton btnOK; private JButton btnCancel; private JButton btnApply; private JPanel
neo mathabe(neomathabe@yahoo.com)
JLabel labV1; private JPanel contentPane; //----- private JPanel... btnCancel; private JButton btnApply; private JPanel...; private JPanel pnlID; //----- private JLabel jLabel2; private
question
question  Good Morning Sir, submit attendance to database using system IP address with current system date and time.using JPanel+mysql+Java
source code - Swing AWT
source code  source code for a program to shutdown, restart, log off the pc after clicking jbutton on jpanel or a jframe by user. thanks in advance
SWING - Swing AWT
SWING  how can i insert image in Jpanel by extending class...; JPanel p; public DisplayImage() { File f=new File("C:/rose.jpg... JLabel(icon); p=new JPanel(); p.add(l); add(p); setVisible
jframe background color not showing
is not showing. please suggest.   Just add the background color to JPanel and then add it to JFrame. For example .. JFrame myFrame = new JFrame(); JPanel myPanel = new JPanel(); JButton myButton = new JButton("myButton"); myPanel.add
Java swings - Swing AWT
container=frame.getContentPane(); JPanel panel=new JPanel(new GridLayout(2,1)); JPanel panel1=new JPanel(new BorderLayout()); JPanel panel2=new JPanel...("C:\\blank.gif"); JPanel panel=new JPanel(new GridLayout(2,1)); JPanel
java swings - Java Beginners
java swings  Hi, I need the sample code for bulk of text added using jpanel. I need the code urgent. Please sedn the code as soon as possible... on the JPanel? Thanks  Do you want to add textfields on the JPanel
Java Swing Card Layout
{ private int currentCard = 1; private JPanel cardPanel; private..."); setSize(300, 150); cardPanel = new JPanel(); cl = new CardLayout(); cardPanel.setLayout(cl); JPanel p1 = new JPanel(); JPanel p2 = new JPanel
Advertisements
 

 

 

DMCA.com