www.pudn.com > dataswap.rar > Test.java
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EtchedBorder;
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
public class Test extends JFrame
{
/**
* @param args
*/
public static void main( String[] args )
{
Test t = new Test();
t.setDefaultCloseOperation( 3 );
t.setVisible( true );
}
public Test()
{
super();
setSize(new Dimension(600, 500));
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (UnsupportedLookAndFeelException e)
{
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
final JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
getContentPane().add(panel, BorderLayout.CENTER);
final JPanel panel_1 = new JPanel();
panel_1.setLayout(new BorderLayout());
panel.add(panel_1, BorderLayout.CENTER);
final JScrollPane scrollPane = new JScrollPane();
panel_1.add(scrollPane, BorderLayout.WEST);
final JList list = new JList();
scrollPane.setViewportView(list);
final JScrollPane scrollPane_1 = new JScrollPane();
panel_1.add(scrollPane_1, BorderLayout.EAST);
final JList list_1 = new JList();
scrollPane_1.setViewportView(list_1);
final JPanel panel_3 = new JPanel();
// panel_3.setPreferredSize(new Dimension(150, 400));
panel_3.setLayout(new GridBagLayout());
panel_1.add(panel_3, BorderLayout.CENTER);
final JButton button_2 = new JButton();
// button_2.setPreferredSize(new Dimension(40, 30));
button_2.setText(">");
final GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.ipadx = 20;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridx = 0;
panel_3.add(button_2, gridBagConstraints);
final JButton button_3 = new JButton();
// button_3.setPreferredSize(new Dimension(40, 30));
button_3.setText(">>");
final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
gridBagConstraints_1.ipadx = 20;
gridBagConstraints_1.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_1.insets = new Insets(10, 0, 10, 0);
gridBagConstraints_1.gridy = 1;
gridBagConstraints_1.gridx = 0;
panel_3.add(button_3, gridBagConstraints_1);
final JButton button_4 = new JButton();
// button_4.setPreferredSize(new Dimension(40, 30));
button_4.setText("<");
final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
gridBagConstraints_2.ipadx = 20;
gridBagConstraints_2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_2.insets = new Insets(0, 0, 10, 0);
gridBagConstraints_2.gridy = 2;
gridBagConstraints_2.gridx = 0;
panel_3.add(button_4, gridBagConstraints_2);
final JButton button_5 = new JButton();
// button_5.setPreferredSize(new Dimension(40, 30));
button_5.setText("<<");
final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
gridBagConstraints_3.ipadx = 20;
gridBagConstraints_3.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints_3.gridy = 3;
gridBagConstraints_3.gridx = 0;
panel_3.add(button_5, gridBagConstraints_3);
final JPanel panel_4 = new JPanel();
panel_1.add(panel_4, BorderLayout.NORTH);
final JComboBox comboBox = new JComboBox();
comboBox.setPreferredSize(new Dimension(300, 25));
panel_4.add(comboBox);
final JPanel panel_2 = new JPanel();
panel.add(panel_2, BorderLayout.SOUTH);
final JButton button = new JButton();
button.setText("New JButton");
panel_2.add(button);
final JButton button_1 = new JButton();
button_1.setText("New JButton");
panel_2.add(button_1);
}
}