コード例 #1
0
    protected JPanel createForm() {
      JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
      // Time
      JPanel pT = new JPanel(new FlowLayout());
      pT.setBorder(BorderFactory.createTitledBorder("Start Time"));
      hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myrow.getTime()), 0, 99, 1));
      hh.setEditor(new JSpinner.NumberEditor(hh, "00"));
      pT.add(hh);
      pT.add(new JLabel("h "));
      mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myrow.getTime()), 0, 59, 1));
      mm.setEditor(new JSpinner.NumberEditor(mm, "00"));
      pT.add(mm);
      pT.add(new JLabel("m "));
      ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myrow.getTime()), 0, 59, 1));
      ss.setEditor(new JSpinner.NumberEditor(ss, "00"));
      pT.add(ss);
      pT.add(new JLabel("s"));
      panel.add(pT);
      // Green
      JPanel pG = new JPanel(new BorderLayout());
      pG.setBorder(BorderFactory.createTitledBorder("Green (sec.)"));
      green = new JSpinner(new SpinnerNumberModel(myrow.getGreen() * conversion, 0.0, 99999.99, 1));
      green.setEditor(new JSpinner.NumberEditor(green, "####0.##"));
      pG.add(green);
      panel.add(pG);
      // Red
      JPanel pR = new JPanel(new BorderLayout());
      pR.setBorder(BorderFactory.createTitledBorder("Red (sec.)"));
      red = new JSpinner(new SpinnerNumberModel(myrow.getRed() * conversion, 0.0, 99999.99, 1));
      red.setEditor(new JSpinner.NumberEditor(red, "####0.##"));
      pR.add(red);
      panel.add(pR);

      JPanel bp = new JPanel(new FlowLayout());
      JButton bOK = new JButton("    OK    ");
      bOK.setActionCommand(cmdOK);
      bOK.addActionListener(new ButtonEventsListener());
      JButton bCancel = new JButton("Cancel");
      bCancel.setActionCommand(cmdCancel);
      bCancel.addActionListener(new ButtonEventsListener());
      bp.add(bOK);
      bp.add(bCancel);
      panel.add(bp);
      return panel;
    }
コード例 #2
0
 /**
  * Initializes event editing panel.
  *
  * @param ne Network Element.
  * @param em Event Manager.
  * @param evt Event.
  */
 protected void initialize(AbstractNetworkElement ne, EventManager em) {
   myNE = ne;
   myEventManager = em;
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   JPanel pH = new JPanel(new FlowLayout());
   JLabel lD =
       new JLabel(
           "<html><font color=\"blue\">"
               + TypesHWC.typeString(myNE.getType())
               + " "
               + myNE.toString()
               + "</font></html>");
   pH.add(lD);
   add(pH);
   // Box dp = Box.createVerticalBox();
   JPanel pD = new JPanel(new BorderLayout());
   pD.setBorder(BorderFactory.createTitledBorder("Description"));
   desc.setText(myEvent.getDescription());
   pD.add(new JScrollPane(desc), BorderLayout.CENTER);
   // dp.add(pD);
   add(pD);
   fillPanel();
   // Box fp = Box.createVerticalBox();
   JPanel pT = new JPanel(new FlowLayout());
   pT.setBorder(BorderFactory.createTitledBorder("Activation Time"));
   hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myEvent.getTime()), 0, 99, 1));
   hh.setEditor(new JSpinner.NumberEditor(hh, "00"));
   pT.add(hh);
   pT.add(new JLabel("h "));
   mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myEvent.getTime()), 0, 59, 1));
   mm.setEditor(new JSpinner.NumberEditor(mm, "00"));
   pT.add(mm);
   pT.add(new JLabel("m "));
   ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myEvent.getTime()), 0, 59.99, 1));
   ss.setEditor(new JSpinner.NumberEditor(ss, "00.##"));
   pT.add(ss);
   pT.add(new JLabel("s"));
   // fp.add(pT);
   add(pT);
   winEE = new WindowEventEditor(this, null);
   winEE.setVisible(true);
   return;
 }