I was trying to learn some new Swing features and im really getting frustrated with JSeparator.. Can anyone explain why it is not showing? Thank you...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
public class Test{
private JFrame frame;
private JButton button1, button2;
public Test(){
createButtons();
createFrame();
}
public void createFrame(){
frame = new JFrame("This is the title");
Container cp = frame.getContentPane();
JPanel panel = new JPanel();
panel.add(button1);
panel.add(new JSeparator(SwingConstants.VERTICAL));
panel.add(button2);
cp.add(panel,BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);
}
public void createButtons(){
button1 = new JButton("Test");
button2 = new JButton("Test 2");
}
}//end class

New Topic/Question
Reply




MultiQuote




|