Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Resizing a JPanel within a Frame
Resizing a JPanel within a Frame [message #446740] Thu, 02 December 2004 05:30 Go to next message
didi is currently offline didiFriend
Messages: 1
Registered: July 2009
Junior Member
How do i increase the size of a JPanel that which is within an AWT Frame
in an InputDialog??? Heres my code of adding the JPanel inside an
InputDialog. But this Doesnt display the entire panel.Though every
component of the JPanel are visible. They r all shortened n incomplete
except untill manually resized.
How do i view the complete panel....How can i resize the Composite as to
view the JPanel completely.
plz help
thanx,didi


/**********************/
JRadioButton[] b = new JRadioButton[5];
JTextField[] tfield = new JTextField[4];
JComboBox box;

protected int getSelectedItem()
{
if( b[0].isSelected()) return 0;
if( b[1].isSelected()) return 1;
if( b[2].isSelected()) return 3;
if( b[3].isSelected()) return 4;

return 5;
}

protected Control createDialogArea(Composite parent) {

Composite composite = (Composite) super.createDialogArea(parent);

/**********************************/
BorderLayout borderlayout = new BorderLayout();
SashForm sashform = new SashForm(composite,SWT.WRAP);
Composite new1 = new Composite(sashform,SWT.EMBEDDED);
Composite new2 = new Composite(sashform,SWT.EMBEDDED);
sashform.setWeights(new int[]{5,2});
GoToFrame = SWT_AWT.new_Frame(new1);
GOFrame = SWT_AWT.new_Frame(new2);
GoToFrame.setLayout(new BorderLayout());
{//go to the event dialog žžµé±â
ButtonGroup group = new ButtonGroup();


b[0] = new JRadioButton("CPU ID: ", false);
group.add(b[0]);
tfield[0] = new JTextField();

b[1] = new JRadioButton("Event type: ", false);
group.add(b[1]);
final String Item[] = {"Trace start","System call entry","System call
exit","Trap entry","Trap exit","IRQ entry",
"IRQ exit","Schedule change","Kernel timer","Soft IRQ","Process
management","File system management",
"Timer management","Memory management","Socket
communication","Inter-process communication",
"Network communication","Creation of custom event","Custom
event occurrence"};

box = new JComboBox(Item);
box.setSelectedIndex(item_index);

b[2] = new JRadioButton("PID: ", false);
group.add(b[2]);
tfield[1] = new JTextField();

b[3] = new JRadioButton("Entry Length: ", false);
group.add(b[3]);
tfield[2] = new JTextField();

b[4] = new JRadioButton("Event Description: ", false);
group.add(b[4]);
tfield[3] = new JTextField();

JPanel upPanel = new JPanel(false);
upPanel.setLayout(new GridLayout(0,1));
upPanel.add(b[0]);
upPanel.add(b[1]);
upPanel.add(b[2]);
upPanel.add(b[3]);
upPanel.add(b[4]);

JPanel fieldPanel = new JPanel(false);
fieldPanel.setLayout(new GridLayout(0,1));
fieldPanel.add(tfield[0]);
fieldPanel.add(box);
fieldPanel.add(tfield[1]);
fieldPanel.add(tfield[2]);
fieldPanel.add(tfield[3]);


switch( division )
{
case 0 : b[0].setSelected(true);
break;
case 1 : b[1].setSelected(true);
break;
case 3 : b[2].setSelected(true);
break;
case 4 : b[3].setSelected(true);
break;
case 5 : b[4].setSelected(true);
break;
}
GoToFrame.add(upPanel);
GOFrame.add(fieldPanel);
//GoToFrame.add(main);
//return main;
}
/***************/
Re: Resizing a JPanel within a Frame [message #446751 is a reply to message #446740] Thu, 02 December 2004 11:59 Go to previous message
James Cooper is currently offline James CooperFriend
Messages: 4
Registered: July 2009
Junior Member
> JPanel upPanel = new JPanel(false);
> upPanel.setLayout(new GridLayout(0,1));
> upPanel.add(b[0]);
> upPanel.add(b[1]);
> upPanel.add(b[2]);
> upPanel.add(b[3]);
> upPanel.add(b[4]);


why are you creating a GridLayout with 0 rows and 1 column, and then
adding 5 controls to it?
Previous Topic:[MacOS X.3.6] laucnching an swt app using Info.plist
Next Topic:[MacOS X] cross-platform export
Goto Forum:
  


Current Time: Thu Mar 28 20:32:16 GMT 2024

Powered by FUDForum. Page generated in 0.04994 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top