コード例 #1
0
  private ExampleList createSimpleComponentExamples() {
    ExampleList exampleList = new ExampleList("Simple Components");
    exampleList.addExample("JLabel", new PSwing(new JLabel("JLabel Example")));
    exampleList.addExample("JCheckBox ", new PSwing(new JCheckBox()));

    JRadioButton radio1 = new JRadioButton("Radio Option 1");
    JRadioButton radio2 = new JRadioButton("Radio Option 1");
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(radio1);
    buttonGroup.add(radio2);
    exampleList.addExample("RadioButton 1", radio1);
    exampleList.addExample("RadioButton 2", radio2);

    JPanel examplePanel =
        new JPanel() {

          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.RED);
            g.fillRect(0, 0, getWidth(), getHeight());
          }
        };
    examplePanel.setPreferredSize(new Dimension(50, 50));

    exampleList.addExample("Custom JPanel ", examplePanel);
    return exampleList;
  }
コード例 #2
0
  private void addButtonOnPanelNoSizing(ExampleList exampleList) {
    JButton button = new JButton("Button");
    JPanel panel = new JPanel();
    panel.add(button);
    PSwing pPanel = new PSwing(panel);

    exampleList.addExample("On JPanel - No Sizing", pPanel);
  }
コード例 #3
0
  private void addButtonOnPanel200x50(ExampleList exampleList) {
    JButton button = new JButton("Button");
    button.setPreferredSize(new Dimension(200, 50));

    JPanel panel = new JPanel();
    panel.add(button);
    PSwing pPanel = new PSwing(panel);

    exampleList.addExample("On JPanel - 200x50", pPanel);
  }
コード例 #4
0
 private void addButtonAlone10x10(ExampleList exampleList) {
   JButton button = new JButton("Button");
   button.setPreferredSize(new Dimension(10, 10));
   PSwing pButton = new PSwing(button);
   exampleList.addExample("Alone - 10x10", pButton);
 }
コード例 #5
0
 private void addButtonAlone200x50(ExampleList exampleList) {
   JButton button = new JButton("Button");
   button.setPreferredSize(new Dimension(200, 50));
   PSwing pButton = new PSwing(button);
   exampleList.addExample("Alone - 200x50", pButton);
 }
コード例 #6
0
 private void addButtonAloneNoSizing(ExampleList exampleList) {
   JButton button = new JButton("Button");
   PSwing pButton = new PSwing(button);
   exampleList.addExample("Alone - No Sizing", pButton);
 }