public class RP extends JPanel
{
private static final long serialVersionUID = 1L;
private JPanel panel = new JPanel();
private JTextField testNameDirectoryTF = new JTextField();
private JComboBox webName = new JComboBox();
private JButton testDateLB = new JButton("test Date");
private JSpinner testDateSpinner = new JSpinner();
private JSpinner forwardDateSpinner = new JSpinner();
private JButton forwardDateLB = new JButton("Date1");
private JButton objectFormatLB = new JButton("Format");
private JComboBox objectFormatCB = new JComboBox();
private JComboBox testSpecialCB = new JComboBox();
private JButton testSpecialLB = new JButton("test");
private JTextField favoritesTF = new JTextField();
private JTextArea testJTA = new JTextArea();
private JScrollPane testScrollBar = new JScrollPane(testJTA);
private ScrollPaneWatermark watermarkInformation = new ScrollPaneWatermark("Your Message" , new Color(77,77,77));
private JProgressBar testJPB = new JProgressBar(0,100);
private JButton showBT = new JButton("show");
private JButton testBT = new JButton("save");
private JButton sendBT = new JButton("send");
final SpinnerDateModel testDateModel = new SpinnerDateModel();
final SpinnerDateModel forwardDateModel = new SpinnerDateModel();
public RP()
{
setLayout(new GridBagLayout());
addJPanelToJFrame(testNameDirectoryTF , 0, 0, 4, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(webName , 0, 1, 4, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(testDateLB , 0, 2, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(testDateSpinner , 1, 2, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(forwardDateSpinner , 2, 2, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(forwardDateLB , 3, 2, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(objectFormatLB , 0, 3, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(objectFormatCB , 1, 3, 1, 1, 1, 1 ,GridBagConstraints.CENTER,GridBagConstraints.BOTH);
addJPanelToJFrame(testSpecialCB , 2, 3, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(testSpecialLB , 3, 3, 1, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(favoritesTF , 0, 4, 4, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(testScrollBar , 0, 5, 4, 1, 1, 10 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame(testJPB , 0, 6, 4, 1, 1, 1 ,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
// Neues Layout setzen für die untersten 3 Komponenten
panel.setLayout(new GridBagLayout());
addJComponentToJPanel( panel,showBT ,0 , 7 , 1 , 1 , 1 , 0.25 , GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJComponentToJPanel( panel,testBT ,1 , 7 , 1 , 1 , 1 , 0.25 , GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJComponentToJPanel( panel,sendBT ,2 , 7 , 1 , 1 , 1 , 0.25 , GridBagConstraints.NORTH,GridBagConstraints.BOTH);
addJPanelToJFrame( panel,0,8,4,1,1,0.25,GridBagConstraints.NORTH,GridBagConstraints.BOTH);
watermarkInformation.setView(testJTA);
watermarkInformation.setBackground(new Color(93,93,93));
testJTA.setLineWrap(true);
testJTA.setWrapStyleWord(true);
testScrollBar.setViewport(watermarkInformation);
testJTA.setBorder(new javax.swing.border.EmptyBorder(10,10,10,10));
}
public void addJPanelToJFrame(JComponent c, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill)
{
add(c, new GridBagConstraints(gridx, gridy, gridwidth, gridheight, weightx, weighty, anchor, fill, new Insets(0, 0, 0, 0), 0, 0));
}
void addJComponentToJPanel(JPanel panel, JComponent c, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill )
{
panel.add(c, new GridBagConstraints(gridx, gridy, gridwidth, gridheight, weightx, weighty, anchor, fill, new Insets(0, 0, 0, 0), 0, 0));
}
}