Hie everyone,
I am trying to develop a GUI through hard coding.
I encountered a challenge:
I created a Jframe and onto this I added a JPanel. I assigned thge flow layout manager of the frame to null(because i want to do the positioning of my components manually)
The program is running perfect except when i click the maximise button of the frame, the JPanel does not change its size.
With Netbeans IDE - i found that the propert is Horizontal Resizable propert. I have tried to look for the method but in vain.
NB. I am trying to develop identical things from hard coding and in drag and drop environment. so with drag and drop its easy but in hard coding how do I work it out?
Here is the code if it is helpful:
public class JPanelDemo {
JFrame frame;
JPanel panel;
JPanelDemo(){
createFrame();
}
public void createFrame(){
//create the frame
frame=new JFrame("GUI Sample");
frame.setSize(new Dimension(750,300));
frame.setMaximumSize(new Dimension(2147483647, 2147483647));
frame.setVisible(true);
//create the panel
panel= new JPanel();
panel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.yellow, Color.black));
panel.setAlignmentX((float) 0.5);
panel.setAlignmentY((float) 0.5);
panel.setDoubleBuffered(true);
panel.setFocusable(true);
panel.setCursor(Cursor.getDefaultCursor());
panel.setMaximumSize(new Dimension(32767, 32767));
panel.setSize(new Dimension(732, 146));
panel.size();
frame.setLayout(null);
frame.add(panel);
}
public static void main(String [] args){
JPanelDemo jpd= new JPanelDemo();
}
}