Hi friends:
In a JApplet, I want to add a JButton to SplitPaneDivider.But the code seem's don't work property. My code is:
////////////// TestApplet extends JApplet ////////////////
public class TestApplet extends JApplet {
public void paint(Graphics g) {
JPanel f=new JPanel();
f.setPreferredSize(new Dimension(300,200));
f.setBackground(Color.green);
f.setVisible(true);
f.setLayout(new BorderLayout());
JButton jep=new JButton("b");
JSplitPane jspcontent=new JSplitPane(JSplitPane.VERTICAL_SPLIT,f,jep);
jspcontent.setOneTouchExpandable(true);
jspcontent.setDividerSize(50);
BasicSplitPaneUI bspUI=(BasicSplitPaneUI)jspcontent.getUI();
JButton b=new JButton("test");
b.setVisible(true);
BasicSplitPaneDivider divi=bspUI.getDivider();
divi.add(b);
divi.setVisible(true);
divi.validate();
this.setContentPane(jspcontent);
this.setVisible(true);
this.validate();
}
}
///////////// end //////////////////
The divider can't display the JButton, why?
But in a frame (None JApplet ) application, it can work property. Does the JApplet can't use BasicSplitPaneDivider ?
:roll:
Thks!
In a JApplet, I want to add a JButton to SplitPaneDivider.But the code seem's don't work property. My code is:
////////////// TestApplet extends JApplet ////////////////
public class TestApplet extends JApplet {
public void paint(Graphics g) {
JPanel f=new JPanel();
f.setPreferredSize(new Dimension(300,200));
f.setBackground(Color.green);
f.setVisible(true);
f.setLayout(new BorderLayout());
JButton jep=new JButton("b");
JSplitPane jspcontent=new JSplitPane(JSplitPane.VERTICAL_SPLIT,f,jep);
jspcontent.setOneTouchExpandable(true);
jspcontent.setDividerSize(50);
BasicSplitPaneUI bspUI=(BasicSplitPaneUI)jspcontent.getUI();
JButton b=new JButton("test");
b.setVisible(true);
BasicSplitPaneDivider divi=bspUI.getDivider();
divi.add(b);
divi.setVisible(true);
divi.validate();
this.setContentPane(jspcontent);
this.setVisible(true);
this.validate();
}
}
///////////// end //////////////////
The divider can't display the JButton, why?
But in a frame (None JApplet ) application, it can work property. Does the JApplet can't use BasicSplitPaneDivider ?
:roll:
Thks!