Beispiel #1
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Beispiel #2
0
 private JPanel getUIPanel() {
   JButton button = new JButton("change data");
   JRadioButton[] rbs = new JRadioButton[5];
   final ButtonGroup group = new ButtonGroup();
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           int index = Integer.parseInt(group.getSelection().getActionCommand());
           double xMin = -MAX, xMax = MAX, yMin = -MAX, yMax = MAX;
           switch (index) {
             case 0:
               xMax = -5;
               break;
             case 1:
               xMin = 5;
               break;
             case 2:
               break;
             case 3:
               yMax = -5;
               break;
             case 4:
               yMin = 5;
           }
           double[] x = getData(xMin, xMax);
           double[] y = getData(yMin, yMax);
           plotPanel.setData(x, y);
         }
       });
   JPanel panel = new JPanel(new GridBagLayout());
   GridBagConstraints gbc = new GridBagConstraints();
   String minus = "<html>\u2013";
   String[] ids = {"<html>\u2013x", "+x", "<html>+/\u2013x&y", "<html>\u2013y", "+y"};
   for (int i = 0; i < rbs.length; i++) {
     rbs[i] = new JRadioButton(ids[i], i == 2);
     rbs[i].setActionCommand(String.valueOf(i));
     group.add(rbs[i]);
     panel.add(rbs[i], gbc);
   }
   panel.setBorder(BorderFactory.createEtchedBorder());
   gbc.weightx = 1.0;
   panel.add(button, gbc);
   return panel;
 }