/**
   * ctor Create view controls on startup and initialize it. We don't start listening here. see
   * setFrame()!
   */
  CustomizeView() {
    this.setLayout(new GridLayout(3, 0));

    m_cbMenuBar = new JCheckBox(MENUBAR_OFF, false);
    m_cbToolBar = new JCheckBox(TOOLBAR_OFF, false);
    m_cbObjectBar = new JCheckBox(OBJECTBAR_OFF, false);

    m_cbMenuBar.setEnabled(false);
    m_cbToolBar.setEnabled(false);
    m_cbObjectBar.setEnabled(false);

    m_cbMenuBar.setActionCommand(ACTION_MENUBAR);
    m_cbToolBar.setActionCommand(ACTION_TOOLBAR);
    m_cbObjectBar.setActionCommand(ACTION_OBJECTBAR);

    this.add(m_cbMenuBar);
    this.add(m_cbToolBar);
    this.add(m_cbObjectBar);
  }
Exemplo n.º 2
0
 public void drawCheckPanel() {
   boxes = new ArrayList<JCheckBox>();
   checkPanel.removeAll();
   checkPanel.setLayout(new GridLayout(files.size(), 1));
   for (int i = 0; i < files.size(); i++) {
     JCheckBox box = new JCheckBox(files.get(i).getTitle());
     box.setActionCommand(files.get(i).getId());
     boxes.add(box);
     checkPanel.add(box);
   }
 }
Exemplo n.º 3
0
  public GLDemo() {
    super(VNMRFrame.getVNMRFrame(), "Jogl Demo", false);

    DisplayOptions.addChangeListener(this);

    contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    gradientPanel = createGradientPanel();

    contentPane.add(gradientPanel, BorderLayout.CENTER);

    checkBox = new JCheckBox("Transparent", true);
    checkBox.setActionCommand("transparancy");
    checkBox.addActionListener(this);
    optionsPan = new JPanel();
    optionsPan.setLayout(new SimpleH2Layout(SimpleH2Layout.LEFT, 5, 0, true, false));
    optionsPan.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    optionsPan.add(checkBox);

    runButton = new JToggleButton("Run");
    runButton.setActionCommand("run");
    runButton.setSelected(false);
    runButton.addActionListener(this);

    optionsPan.add(runButton);

    getContentPane().add(optionsPan, BorderLayout.SOUTH);
    setSize(300, 300);
    setLocation(300, 300);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Run this on another thread than the AWT event queue to
            // make sure the call to Animator.stop() completes before
            // exiting
            new Thread(
                    new Runnable() {
                      public void run() {
                        stop();
                      }
                    })
                .start();
          }
        });
    setVisible(false);
  }
Exemplo n.º 4
0
    protected void initComponents(
        AirspaceBuilderModel model, final AirspaceBuilderController controller) {
      final JCheckBox resizeNewShapesCheckBox;
      final JCheckBox enableEditCheckBox;

      JPanel newShapePanel = new JPanel();
      {
        JButton newShapeButton = new JButton("New shape");
        newShapeButton.setActionCommand(NEW_AIRSPACE);
        newShapeButton.addActionListener(controller);
        newShapeButton.setToolTipText("Create a new shape centered in the viewport");

        this.factoryComboBox = new JComboBox(defaultAirspaceFactories);
        this.factoryComboBox.setEditable(false);
        this.factoryComboBox.setToolTipText("Choose shape type to create");

        resizeNewShapesCheckBox = new JCheckBox("Fit new shapes to viewport");
        resizeNewShapesCheckBox.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT);
        resizeNewShapesCheckBox.addActionListener(controller);
        resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
        resizeNewShapesCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        resizeNewShapesCheckBox.setToolTipText(
            "New shapes are sized to fit the geographic viewport");

        enableEditCheckBox = new JCheckBox("Enable shape editing");
        enableEditCheckBox.setActionCommand(ENABLE_EDIT);
        enableEditCheckBox.addActionListener(controller);
        enableEditCheckBox.setSelected(controller.isEnableEdit());
        enableEditCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        enableEditCheckBox.setToolTipText("Allow modifications to shapes");

        Box newShapeBox = Box.createHorizontalBox();
        newShapeBox.add(newShapeButton);
        newShapeBox.add(Box.createHorizontalStrut(5));
        newShapeBox.add(this.factoryComboBox);
        newShapeBox.setAlignmentX(Component.LEFT_ALIGNMENT);

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(newShapeBox);
        gridPanel.add(resizeNewShapesCheckBox);
        gridPanel.add(enableEditCheckBox);

        newShapePanel.setLayout(new BorderLayout());
        newShapePanel.add(gridPanel, BorderLayout.NORTH);
      }

      JPanel entryPanel = new JPanel();
      {
        this.entryTable = new JTable(model);
        this.entryTable.setColumnSelectionAllowed(false);
        this.entryTable.setRowSelectionAllowed(true);
        this.entryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.entryTable
            .getSelectionModel()
            .addListSelectionListener(
                new ListSelectionListener() {
                  public void valueChanged(ListSelectionEvent e) {
                    if (!ignoreSelectEvents) {
                      controller.actionPerformed(
                          new ActionEvent(e.getSource(), -1, SELECTION_CHANGED));
                    }
                  }
                });
        this.entryTable.setToolTipText("<html>Click to select<br>Double-Click to rename</html>");

        JScrollPane tablePane = new JScrollPane(this.entryTable);
        tablePane.setPreferredSize(new Dimension(200, 100));

        entryPanel.setLayout(new BorderLayout(0, 0)); // hgap, vgap
        entryPanel.add(tablePane, BorderLayout.CENTER);
      }

      JPanel selectionPanel = new JPanel();
      {
        JButton delselectButton = new JButton("Deselect");
        delselectButton.setActionCommand(CLEAR_SELECTION);
        delselectButton.addActionListener(controller);
        delselectButton.setToolTipText("Clear the selection");

        JButton deleteButton = new JButton("Delete Selected");
        deleteButton.setActionCommand(REMOVE_SELECTED);
        deleteButton.addActionListener(controller);
        deleteButton.setToolTipText("Delete selected shapes");

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(delselectButton);
        gridPanel.add(deleteButton);

        selectionPanel.setLayout(new BorderLayout());
        selectionPanel.add(gridPanel, BorderLayout.NORTH);
      }

      this.setLayout(new BorderLayout(30, 0)); // hgap, vgap
      this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); // top, left, bottom, right
      this.add(newShapePanel, BorderLayout.WEST);
      this.add(entryPanel, BorderLayout.CENTER);
      this.add(selectionPanel, BorderLayout.EAST);

      controller.addPropertyChangeListener(
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getPropertyName())) {
                resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
              } else if (ENABLE_EDIT.equals(e.getPropertyName())) {
                enableEditCheckBox.setSelected(controller.isEnableEdit());
              }
            }
          });
    }
  public DiameterCutOptionsTargetPanel() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Lungime:", 100));
    JFormattedTextField length = GUIFactory.createNumberInput(4100L, 0L, 1000000L, 80);
    panel.add(length);
    JComboBox<String> mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 1:", 100));
    JFormattedTextField smallRadius = GUIFactory.createNumberInput(200L, 0L, 1000000L, 80);
    panel.add(smallRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.add(GUIFactory.createLabel("Diametru 2:", 100));
    JFormattedTextField bigRadius = GUIFactory.createNumberInput(600L, 0L, 1000000L, 80);
    panel.add(bigRadius);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.addItemListener(this);
    mCombo = new JComboBox<String>(GUIUtil.metric);
    mCombo.setPreferredSize(new Dimension(50, mCombo.getPreferredSize().height));
    panel.add(mCombo);
    add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    label2 = GUIFactory.createLabel("Produse:", 100);
    panel.add(label2);
    products = ProductDAO.getProducts();
    JPanel productsPanel = new JPanel();
    productsPanel.setLayout(new BoxLayout(productsPanel, BoxLayout.Y_AXIS));
    for (Product product : products) {
      JPanel row = new JPanel(new FlowLayout(FlowLayout.LEFT));
      JCheckBox chk = new JCheckBox();
      row.add(chk);
      selection.add(chk);
      chk.setName("length" + (long) product.getLength());
      row.add(new JLabel(product.getName()));
      productsPanel.add(row);
    }
    JScrollPane scrollPane = new JScrollPane(productsPanel);
    scrollPane.setPreferredSize(new Dimension(productsPanel.getPreferredSize().width + 20, 215));
    panel.add(scrollPane);
    add(panel);

    JPanel filtru = new JPanel(new FlowLayout(FlowLayout.LEADING));
    filtru.add(filtru2m);
    filtru.add(filtru3m);
    filtru.add(filtru4m);
    filtru2m.setActionCommand("FILTRU2");
    filtru3m.setActionCommand("FILTRU3");
    filtru4m.setActionCommand("FILTRU4");
    filtru2m.addActionListener(this);
    filtru3m.addActionListener(this);
    filtru4m.addActionListener(this);
    panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JLabel label1 = GUIFactory.createLabel("Filtru", 100);
    panel.add(label1);
    panel.add(filtru);
    add(panel);

    cancel.setActionCommand("CANCEL_DIALOG");
    cancel.addActionListener(GUIUtil.main);
    see.addActionListener(this);
  }