java - Restrict the JPanel size issue -
good day-
i'm working on japplets in have 2 tabbedpanel. first tabbed need further divide parent jpanel 2 parts. created 2 sub panels , have used jsplitpane class split 2 parts.
- eastpanel
- westpanel
the windows looks following:
this resizeable can see maximize button enable. have tried set method setresizeable() think it's available jframe.
the desired ui i'm try create following:
what need restrict size won't maximize anymore , content placed in jpanel. please guide me approach should follow achieve desired results? furthermore source following:
public class createpanel extends jpanel { private vector athletelist; private jbutton button1; private countpanel cpanel; private textfield firstname; private textarea textarea; //constructor initializes components , organize them using layouts public createpanel(vector athletelist, countpanel cpanel) { this.athletelist = athletelist; this.cpanel = cpanel; //inner jpanels split parent panel jpanel eastpanel = new jpanel(); jpanel westpanel = new jpanel(); button1 = new jbutton("create athlete"); textarea = new textarea("no athlete"); textarea.seteditable(false); eastpanel.setbackground(color.red); westpanel.setbackground(color.blue); eastpanel.add(button1); /* p1.add(firstname); p2.add(textarea);*/ jsplitpane sp = new jsplitpane(jsplitpane.horizontal_split); sp.setresizeweight(0.5); sp.setdividersize(0); sp.add(eastpanel); sp.add(westpanel); //organize components here setlayout( new gridlayout(1, 2)); // add(firstname,borderlayout.west); add(sp); } //buttonlistener listener class listens //see if button "create athlete" pushed. //when event occurs, adds athlete using information //entered user. //it performs error checking. private class buttonlistener implements actionlistener { public void actionperformed(actionevent event) { //to completed } //end of actionperformed method } //end of buttonlistener class } driveclass
public class test extends japplet { private int applet_width = 500, applet_height = 400; private jtabbedpane tpane; private createpanel createpanel; private countpanel countpanel; private vector athletelist; //the method init initializes applet pane 2 tabs public void init() { //list of athletes used in every panel athletelist = new vector(); //register panel uses list of athletes countpanel = new countpanel(athletelist); createpanel = new createpanel(athletelist, countpanel); //create tabbed pane 2 tabs tpane = new jtabbedpane(); tpane.addtab("athlete creation", createpanel); tpane.addtab("medal count", countpanel); getcontentpane().add(tpane); setsize (applet_width, applet_height); //set applet size setpreferredsize(new dimension(applet_width, applet_height)); setmaximumsize(this.getpreferredsize()); setminimumsize(this.getpreferredsize()); } } help appreciated.many thanks


Comments
Post a Comment