public BallsFrame() throws HeadlessException {
   super("Funny balls");
   setLayout(new BorderLayout());
   executorService = Executors.newScheduledThreadPool(1);
   ballsPanel =
       new JPanel() {
         @Override
         protected void paintComponent(Graphics g) {
           super.paintComponent(g);
           if (blueBallVisible) {
             g.setColor(Color.BLUE);
             g.fillOval(blueBall.x, getHeight() / 2, BALL_DIAGONAL, BALL_DIAGONAL);
           }
           g.setColor(Color.RED);
           g.fillOval(redBall.x, getHeight() / 2, BALL_DIAGONAL, BALL_DIAGONAL);
         }
       };
   add(ballsPanel, BorderLayout.CENTER);
   blueBallSwitch = new JCheckBox("Collision", true);
   blueBallSwitch.addItemListener(
       e -> {
         if (blueBallVisible = blueBallSwitch.isSelected()) {
           int x;
           do x = random.nextInt(getWidth() - BALL_DIAGONAL);
           while (redBall.x <= x && x <= redBall.rightX()
               || redBall.x <= x + BALL_DIAGONAL && x + BALL_DIAGONAL <= redBall.rightX());
           blueBall.x = x;
         }
       });
   add(blueBallSwitch, BorderLayout.SOUTH);
   blueBallVisible = true;
   moveToRight = true;
   setSize(500, 500);
 }
Exemplo n.º 2
0
  public JComponent CreateOpTab(
      String operatorName, Map<String, Object> parameterMap, AppContext appContext) {

    initializeOperatorUI(operatorName, parameterMap);
    final JComponent panel = createPanel();

    bandList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(final ListSelectionEvent e) {
            setNumberOfEigenvalues();
          }
        });

    showEigenvalues.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            showEigenvaluesFlag = (e.getStateChange() == ItemEvent.SELECTED);
          }
        });

    subtractMeanImage.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            subtractMeanImageFlag = (e.getStateChange() == ItemEvent.SELECTED);
          }
        });

    initParameters();

    return panel;
  }
Exemplo n.º 3
0
  public JCheckBox2() {
    f = new JFrame("JCheckBox");
    Container contentPane = f.getContentPane();
    contentPane.setLayout(new GridLayout(2, 1));
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(1, 3));
    p1.setBorder(BorderFactory.createTitledBorder("你最喜欢哪家快餐店?"));
    JCheckBox c1 = new JCheckBox("麦当劳");
    JCheckBox c2 = new JCheckBox("肯德基");
    JCheckBox c3 = new JCheckBox("德克士");
    p1.add(c1);
    p1.add(c2);
    p1.add(c3);
    JPanel p2 = new JPanel();
    p2.setLayout(new GridLayout(2, 1));
    p2.setBorder(BorderFactory.createTitledBorder("你最喜欢哪种程序语言?"));
    c4 = new JCheckBox("JAVA", new ImageIcon(ClassLoader.getSystemResource("img1.jpg")));
    c5 = new JCheckBox("C++", new ImageIcon(ClassLoader.getSystemResource("img1.jpg")));
    c4.addItemListener(this);
    c5.addItemListener(this);
    p2.add(c4);
    p2.add(c5);
    contentPane.add(p1);
    contentPane.add(p2);

    f.pack();
    f.setVisible(true);
    f.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
Exemplo n.º 4
0
  public Bottom() {

    setPreferredSize(new Dimension(Setup.getWidth(), Setup.getHeight() / 4));

    setLayout(new BorderLayout());

    start.addActionListener(new ButtonListener());
    help.addActionListener(new ButtonListener());

    JPanel left = new JPanel();
    JPanel right = new JPanel();

    saveMask.setEnabled(false);

    coins.addItemListener(new OptionsListener());
    saveMask.addItemListener(new OptionsListener());

    left.add(coins);
    left.add(saveMask);

    right.add(help);
    right.add(start);

    add(right, BorderLayout.EAST);
    add(left, BorderLayout.WEST);
  }
Exemplo n.º 5
0
  public MixingColors() {
    super("Selecting a color");
    contents = getContentPane();
    contents.setLayout(new FlowLayout());

    red = new JCheckBox("red");
    green = new JCheckBox("green");
    blue = new JCheckBox("blue");

    label = new JLabel("Watch my background");
    label.setOpaque(true);
    label.setForeground(Color.GRAY);
    label.setBackground(new Color(0, 0, 0));

    contents.add(red);
    contents.add(green);
    contents.add(blue);
    contents.add(label);

    // create CheckBoxHandler event handler
    // and register it on the checkboxes
    CheckBoxHandler cbh = new CheckBoxHandler();
    red.addItemListener(cbh);
    green.addItemListener(cbh);
    blue.addItemListener(cbh);

    setSize(225, 200);
    setVisible(true);
  }
Exemplo n.º 6
0
  @SuppressWarnings({"unchecked"})
  public SimulationPanel(final MainFrame frame, final PartitionDataList dataList) {

    this.frame = frame;
    this.dataList = dataList;

    optionPanel = new OptionsPanel(12, 12, SwingConstants.CENTER);

    simulationsNumberField = new WholeNumberField(1, Integer.MAX_VALUE);
    simulationsNumberField.setColumns(10);
    simulationsNumberField.setValue(dataList.simulationsCount);
    optionPanel.addComponentWithLabel("Number of simulations:", simulationsNumberField);

    setSeed = new JCheckBox();
    setSeed.addItemListener(new SetSeedCheckBoxListener());
    setSeed.setSelected(dataList.setSeed);
    optionPanel.addComponentWithLabel("Set seed:", setSeed);

    startingSeedNumberField = new WholeNumberField(1, Long.MAX_VALUE);
    startingSeedNumberField.setColumns(10);
    startingSeedNumberField.setValue(dataList.startingSeed);
    startingSeedNumberField.setEnabled(dataList.setSeed);
    optionPanel.addComponentWithLabel("Starting seed:", startingSeedNumberField);

    outputFormat = new JComboBox();
    optionPanel.addComponentWithLabel("Output format:", outputFormat);
    outputFormatModel = new DefaultComboBoxModel(SimpleAlignment.OutputType.values());
    outputFormat.setModel(outputFormatModel);

    outputAncestralSequences = new JCheckBox();
    outputAncestralSequences.addItemListener(new outputAncestralSequencesCheckBoxListener());
    outputAncestralSequences.setSelected(dataList.useParallel);
    optionPanel.addComponentWithLabel("Output ancestral sequences:", outputAncestralSequences);

    useParallel = new JCheckBox();
    useParallel.addItemListener(new UseParallelCheckBoxListener());
    useParallel.setSelected(dataList.useParallel);
    optionPanel.addComponentWithLabel("Use parallel implementation:", useParallel);

    // Buttons holder
    JPanel buttonsHolder = new JPanel();
    buttonsHolder.setOpaque(false);

    // simulate button
    simulate = new JButton("Simulate", Utils.createImageIcon(Utils.BIOHAZARD_ICON));
    simulate.addActionListener(new ListenSimulate());
    buttonsHolder.add(simulate);

    generateXML = new JButton("Generate XML", Utils.createImageIcon(Utils.HAMMER_ICON));
    generateXML.addActionListener(new ListenGenerateXML());
    buttonsHolder.add(generateXML);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(optionPanel, BorderLayout.NORTH);
    add(buttonsHolder, BorderLayout.SOUTH);
  } // END: SimulationPanel
 private void initSoftWrapsSettingsProcessing() {
   ItemListener listener =
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           updateSoftWrapSettingsRepresentation();
         }
       };
   myCbUseSoftWrapsAtEditor.addItemListener(listener);
   myCbUseCustomSoftWrapIndent.addItemListener(listener);
 }
Exemplo n.º 8
0
    protected CompileCppDialog(
        Project _project, CompileHandler compilerHandler, CompileCppOptions options) {
      super(_project, false);

      project = _project;
      setModal(true);

      doRun.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              final boolean b = doRun.isSelected();
              executableFileName.setEnabled(b);
              executableFileName.setEditable(b);
            }
          });

      executableFileName.getEditor().setItem(options != null ? options.getOutputFileName() : "");
      doRun.setSelected(lastRunStatus);

      final CppSupportLoader loader = CppSupportLoader.getInstance(project);
      final String compileParameters = loader.getAdditionalCompileParameters();

      compileProperties.setText(
          (compileParameters != null && compileParameters.length() > 0
                  ? compileParameters + " "
                  : "")
              + CompileHandler.MARKER);

      setTitle(CppBundle.message("compile.cpp.file.dialog.title"));

      compilerSelector.setModel(
          new DefaultComboBoxModel(CppSupportSettings.CompilerSelectOptions.values()));
      compilerSelector.setSelectedItem(getCurrentCompilerOption(project));

      setSelectedProjectCompile();

      includeProjectCompileParametersCheckBox.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              setSelectedProjectCompile();
            }
          });

      includeProjectCompileParametersCheckBox.setSelected(loader.isIncludeProjectSettings());
      final String compileParametersText = compilerHandler.buildProjectCompileOptions(project);
      projectCompileParameters.setText(compileParametersText != null ? compileParametersText : "");

      init();
    }
  private JPanel createOptionsPanel() {
    JPanel optionsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1;
    c.gridx = 0;
    c.ipady = 2;
    c.fill = GridBagConstraints.BOTH;
    optionsPanel.add(mySaveTransientModelsCheckBox, c);
    optionsPanel.add(myCheckModelsBeforeGenerationCheckBox, c);
    optionsPanel.add(myStrictMode, c);
    c.ipady = 0;
    optionsPanel.add(createParallelGenerationGroup(), c);
    c.ipady = 2;
    optionsPanel.add(myIncremental, c);
    c.insets.left = 16;
    optionsPanel.add(myIncrementalCache, c);
    if (InternalFlag.isInternalMode()) {
      optionsPanel.add(myDebugIncrementalDependencies, c);
    }
    c.insets.left = 0;
    optionsPanel.add(myInplaceTransform, c);

    myButtonState.track(
        mySaveTransientModelsCheckBox,
        myCheckModelsBeforeGenerationCheckBox,
        myStrictMode,
        myInplaceTransform);
    myButtonState.track(myDebugIncrementalDependencies, myIncremental, myIncrementalCache);

    final ChangeListener listener =
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            myIncremental.setEnabled(myStrictMode.isSelected());
            myIncrementalCache.setEnabled(myStrictMode.isSelected() && myIncremental.isSelected());
            if (InternalFlag.isInternalMode()) {
              myDebugIncrementalDependencies.setEnabled(
                  myStrictMode.isSelected() && myIncremental.isSelected());
            }
          }
        };
    myStrictMode.addChangeListener(listener);
    myIncremental.addChangeListener(listener);
    optionsPanel.setBorder(IdeBorderFactory.createTitledBorder("General"));

    mySaveTransientModelsCheckBox.addItemListener(myStatusUpdater);
    myInplaceTransform.addItemListener(myStatusUpdater);
    return optionsPanel;
  }
Exemplo n.º 10
0
 public ConstraintsOptionsPanel(WorkbenchContext workbenchContext) {
   this.workbenchContext = workbenchContext;
   try {
     this.jbInit();
     this.init();
   } catch (Exception e) {
     Assert.shouldNeverReachHere(e.toString());
   }
   relativeAngleRadioButton.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           if (start) {
             SettingOptionsDialog.page.fireButtonEvent(
                 ButtonEvent.ENABLE_BUTTON, ButtonNames.APPLY);
           }
         }
       });
   lengthCheckBox.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           updateEnabled();
         }
       });
   constrainIncrementalAngleCheckBox.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           updateEnabled();
         }
       });
   constrainAngleCheckBox.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           updateEnabled();
         }
       });
   numPartsTextField.addFocusListener(
       new myFocusListener() {
         public void focusLost(FocusEvent e) {
           double newAngle = 360.0 / Double.parseDouble(numPartsTextField.getText());
           // constrainIncrementalAngleCheckBox.setText("Constrain angle to " + newAngle + " degree
           // increments");
           // [sstein: 16.10.2005]
           constrainIncrementalAngleCheckBox.setText(
               constrainAngleByStepsOf + " " + newAngle + " " + degree);
         }
       });
 }
  /** The constructor. */
  public StylePanelFigNodeModelElement() {
    super();
    shadowField.addItemListener(this);

    getFillField().setRenderer(new ColorRenderer());
    getLineField().setRenderer(new ColorRenderer());

    shadowLabel.setLabelFor(shadowField);
    add(shadowLabel);
    add(shadowField);

    displayPane = new JPanel();
    displayPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    addToDisplayPane(pathCheckBox);

    displayLabel.setLabelFor(displayPane);
    add(displayPane, 0); // add in front of the others
    add(displayLabel, 0); // add the label in front of the "pane"

    // This instead of the label ???
    // displayPane.setBorder(new TitledBorder(
    //    Translator.localize("Display: ")));

    pathCheckBox.addItemListener(this);
  }
Exemplo n.º 12
0
  private JPanel getClickableTagsPanel() {
    JPanel pnl = new JPanel();

    pnl.setLayout(new GridLayout(0, 3));

    ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values());
    Collections.sort(listTags);

    for (final Commontags ctag : listTags) {
      JCheckBox cb = new JCheckBox(ctag.getText());

      cb.setForeground(GUITools.getColor(ctag.getColor()));
      cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD);

      cb.setSelected(listSelectedTags.contains(ctag));

      cb.addItemListener(
          e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              listSelectedTags.add(ctag);
              add(createButton(ctag));
            } else {
              listSelectedTags.remove(ctag);
              mapButtons.remove(ctag);
            }
            notifyListeners(ctag);
          });

      pnl.add(cb);
    }
    return pnl;
  }
Exemplo n.º 13
0
  @Override
  public JComponent config() {
    FormLayout layout =
        new FormLayout("left:pref, 0:grow", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, 0:grow");
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);
    builder.setOpaque(false);

    CellConstraints cc = new CellConstraints();

    JComponent cmp = builder.addSeparator("Audio settings", cc.xyw(2, 1, 1));
    cmp = (JComponent) cmp.getComponent(0);
    cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

    noresample = new JCheckBox(Messages.getString("TrTab2.22"));
    noresample.setContentAreaFilled(false);
    noresample.setSelected(configuration.isAudioResample());
    noresample.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            configuration.setAudioResample(e.getStateChange() == ItemEvent.SELECTED);
          }
        });
    builder.add(noresample, cc.xy(2, 3));

    return builder.getPanel();
  }
    public OrderItem(ExpressOrderVO expressorder) {
      setOpaque(false);
      this.expressorder = expressorder;
      check = new JCheckBox();
      check.setOpaque(false);
      check.addItemListener(
          new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
              // TODO 自动生成的方法存根
              if (e.getStateChange() == ItemEvent.SELECTED) {
                selected();
              } else {
                deSelected();
              }
            }
          });
      order_id = new GAPTextField(expressorder.order_id, 12);
      order_id.setCenter();
      order_id.closeEdit();

      target_add = new GAPTextField(expressorder.receiver_info.getDepart(), 20);
      target_add.setCenter();
      target_add.closeEdit();

      gb = new GridBagLayout();
      gcons = new GridBagConstraints();

      setLayout(gb);

      SwingConsole.addComponent(gb, gcons, this, check, 0, 0, 1, 1, 0, 0);
      SwingConsole.addComponent(gb, gcons, this, order_id, 1, 0, 1, 1, 0.5, 0);
      SwingConsole.addComponent(gb, gcons, this, target_add, 2, 0, 1, 1, 0.5, 0);
    }
  protected void createRemoveParamsPanel(GridBagConstraints gbConstraints, JPanel panel) {
    final JCheckBox[] removeParamsCb = new JCheckBox[myParametersToRemove.length];
    for (int i = 0; i < myParametersToRemove.length; i++) {
      PsiParameter parameter = myParametersToRemove[i];
      if (parameter == null) continue;
      final NonFocusableCheckBox cb =
          new NonFocusableCheckBox(
              RefactoringBundle.message("remove.parameter.0.no.longer.used", parameter.getName()));
      removeParamsCb[i] = cb;
      cb.setSelected(true);
      gbConstraints.gridy++;
      panel.add(cb, gbConstraints);
      final int i1 = i;
      cb.addChangeListener(
          new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
              myParametersToRemoveChecked[i1] = cb.isSelected();
            }
          });
      myParametersToRemoveChecked[i] = true;
    }

    updateControls(removeParamsCb);
    if (myCbReplaceAllOccurences != null) {
      myCbReplaceAllOccurences.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              updateControls(removeParamsCb);
            }
          });
    }
  }
Exemplo n.º 16
0
 private JCheckBox createCheckBox(String s, boolean b, int y) {
   JCheckBox cb = new JCheckBox(s, b);
   cb.setFont(font);
   cb.setHorizontalAlignment(JCheckBox.LEFT);
   cb.addItemListener(this);
   Java2Demo.addToGridBag(this, cb, 0, y, 1, 1, 1.0, 1.0);
   return cb;
 }
Exemplo n.º 17
0
 private void addTempBonus(final Set<String> names) {
   for (String name : names) {
     JCheckBox aBox = new JCheckBox(name, !pc.getTempBonusFilters().contains(name));
     aBox.addItemListener(new CheckBoxUpdater(name, pc, theParent));
     modifiersPanel.add(aBox);
     tempBonusWidgets.put(name, aBox);
   }
 }
  public Insurance() {

    CampanyNamelabel = new JLabel("JInsurance");

    HMOchkBox = new JCheckBox("HOM");
    PPOchkBox = new JCheckBox("PPO");
    DentalInsurancechkBox = new JCheckBox("Dental Insurance");
    VisionInsurancechkBox = new JCheckBox("Vision Insurance");

    OutputTextbox = new JTextField(20);

    btnGroup = new ButtonGroup();

    north = new JPanel();
    center = new JPanel();
    south = new JPanel();

    north.setLayout(new BorderLayout());
    north.add(CampanyNamelabel);

    north.setLayout(new FlowLayout(FlowLayout.CENTER));

    center.setLayout(new BorderLayout());
    center.add(HMOchkBox);
    center.add(DentalInsurancechkBox);
    center.add(PPOchkBox);
    center.add(VisionInsurancechkBox);
    center.setLayout(new GridLayout(2, 2));

    btnGroup.add(HMOchkBox);
    btnGroup.add(PPOchkBox);

    south.setLayout(new BorderLayout());
    south.add(OutputTextbox);

    south.setLayout(new FlowLayout(FlowLayout.CENTER));

    add(north, BorderLayout.NORTH);
    add(center, BorderLayout.CENTER);
    add(south, BorderLayout.SOUTH);

    HMOchkBox.addItemListener(this);
    PPOchkBox.addItemListener(this);
    DentalInsurancechkBox.addItemListener(this);
    VisionInsurancechkBox.addItemListener(this);
  }
Exemplo n.º 19
0
  public void test_undoRedoSnapshotMode() throws Exception {
    DetailDataSource dataSource = new DetailDataSource(new MadGuiContext());

    final JCheckBox checkBox = new JCheckBox();
    final JTextField textField = new JTextField();
    final NoNullDateField dateField = new NoNullDateField();
    dateFieldWrapper = new Panel(dateField);
    textFieldWrapper = new TextBox(textField);
    checkBoxWrapper = new CheckBox(checkBox);

    dataSource.declare("checkbox", checkBox);
    dataSource.declare("textfield", textField);
    dataSource.declare("date", dateField);

    buttonPanelLogic.setMainDataSource(dataSource);

    checkBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent event) {
            if (checkBox.isSelected()) {
              buttonPanelLogic.startSnapshotMode();
              textField.setText("OK");
              dateField.setDate(java.sql.Date.valueOf("2007-08-24"));
              buttonPanelLogic.stopSnapshotMode();
            }
          }
        });

    assertGuiComponents(false, "", "");

    checkBoxWrapper.click();
    Thread.sleep(200);
    assertGuiComponents(true, "OK", "24-08-2007");

    textFieldWrapper.pressKey(Key.N);
    assertGuiComponents(true, "NOK", "24-08-2007");

    dateField.setDate(java.sql.Date.valueOf("2007-08-30"));
    assertGuiComponents(true, "NOK", "30-08-2007");

    undo();
    assertGuiComponents(true, "NOK", "24-08-2007");

    undo();
    assertGuiComponents(true, "OK", "24-08-2007");

    undo();
    assertGuiComponents(false, "", "");

    redo();
    assertGuiComponents(true, "OK", "24-08-2007");

    redo();
    assertGuiComponents(true, "NOK", "24-08-2007");

    redo();
    assertGuiComponents(true, "NOK", "30-08-2007");
  }
Exemplo n.º 20
0
  private void initPanelVisualizacion() {
    panelVisualizacion = new JPanel();
    panelVisualizacion.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Visualizacion",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    GridBagConstraints gbc_panelVisualizacion = new GridBagConstraints();
    gbc_panelVisualizacion.fill = GridBagConstraints.BOTH;
    gbc_panelVisualizacion.insets = new Insets(5, 5, 0, 5);
    gbc_panelVisualizacion.gridx = 0;
    gbc_panelVisualizacion.gridy = 3;
    panelOpciones.add(panelVisualizacion, gbc_panelVisualizacion);
    GridBagLayout gbl_panelVisualizacion = new GridBagLayout();
    gbl_panelVisualizacion.columnWidths = new int[] {48, 0};
    gbl_panelVisualizacion.rowHeights = new int[] {29, 0, 0};
    gbl_panelVisualizacion.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_panelVisualizacion.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    panelVisualizacion.setLayout(gbl_panelVisualizacion);

    comboVista = new JComboBox();
    GridBagConstraints gbc_comboVista = new GridBagConstraints();
    gbc_comboVista.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboVista.insets = new Insets(5, 5, 5, 5);
    gbc_comboVista.gridx = 0;
    gbc_comboVista.gridy = 0;
    panelVisualizacion.add(comboVista, gbc_comboVista);
    comboVista.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            if (item.getStateChange() == ItemEvent.SELECTED) {
              actualizarVista();
            }
          }
        });
    comboVista.setModel(
        new DefaultComboBoxModel(new String[] {"Puntos", "Triangulacion", "Solido"}));
    comboVista.setSelectedIndex(2);
    comboVista.setToolTipText("Modo de Visualizacion");

    chckbxBackfaceCulling = new JCheckBox("Backface Culling");
    chckbxBackfaceCulling.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            panelImagen.setBackfaceCulling(item.getStateChange() == ItemEvent.SELECTED);
          }
        });
    GridBagConstraints gbc_chckbxBackfaceCulling = new GridBagConstraints();
    gbc_chckbxBackfaceCulling.anchor = GridBagConstraints.WEST;
    gbc_chckbxBackfaceCulling.insets = new Insets(0, 10, 0, 0);
    gbc_chckbxBackfaceCulling.gridx = 0;
    gbc_chckbxBackfaceCulling.gridy = 1;
    panelVisualizacion.add(chckbxBackfaceCulling, gbc_chckbxBackfaceCulling);
  }
Exemplo n.º 21
0
 public DCCheckBox(String text, boolean selected) {
   super(text, selected);
   if (!StringUtils.isNullOrEmpty(text)) {
     setBorder(REGULAR_BORDER);
     setBorderPainted(true);
     addMouseListener(this);
   }
   super.addItemListener(this);
 }
 private void initVcsSettingsProcessing() {
   myShowLSTInGutterCheckBox.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           myShowWhitespacesModificationsInLSTGutterCheckBox.setEnabled(
               myShowLSTInGutterCheckBox.isSelected());
         }
       });
 }
Exemplo n.º 23
0
  /** Build a style panel. Just layout the relevant boxes. */
  public StylePanelFigUseCase() {
    // Invoke the parent constructor first
    super();

    addToDisplayPane(epCheckBox);
    // By default we don't show the attribute check box. Mark this object
    // as a listener for the check box.
    epCheckBox.setSelected(false);
    epCheckBox.addItemListener(this);
  }
Exemplo n.º 24
0
 @Override
 public void attachListener(JCheckBox c) {
   c.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent arg0) {
           valider();
         }
       });
 }
Exemplo n.º 25
0
  private void initComponents() {

    panel = new JPanel();
    panel.setBorder(new TitledBorder("Search users"));
    panel.setBounds(10, 10, 360, 170);
    panel.setLayout(null);

    jMessage = new javax.swing.JLabel();
    jMessage.setFont(new java.awt.Font("Comic Sans MS", 0, 16)); // NOI18N
    this.add(jMessage);
    jMessage.setBounds(40, 90, 150, 30);
    jMessage.setText("");

    backButton = new javax.swing.JButton();
    backButton.setFont(new java.awt.Font("Comic Sans MS", 0, 13)); // NOI18N
    backButton.setText("Back");
    panel.add(backButton);
    backButton.setBounds(270, 120, 80, 30); // 310 300 80 30
    backButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            backButtonActionPerformed(evt);
          }
        });

    searchCheckBox = new JCheckBox("Use regular expressions");
    panel.add(searchCheckBox);
    searchCheckBox.setBounds(30, 60, 250, 30);
    searchCheckBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            searchCheckBoxPerformed(e);
          }
        });

    okButton = new JButton();
    okButton.setFont(new java.awt.Font("Comic Sans MS", 0, 13));
    okButton.setText("OK");
    panel.add(okButton);
    okButton.setBounds(140, 120, 80, 30);
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            okButtonActionPerfomed(e);
          }
        });

    // TextFields
    tfsearch = new JTextField();
    tfsearch.setFont(new java.awt.Font("Comic Sans MS", 0, 13));
    panel.add(tfsearch);
    tfsearch.setBounds(30, 30, 300, 30);

    add(panel);
  }
Exemplo n.º 26
0
    public CheckBoxCellRenderer() {
      super();

      if (noFocusBorder == null) {
        noFocusBorder = new EmptyBorder(1, 1, 1, 1);
      }

      checkBox = new JCheckBox();
      checkBox.addItemListener(this);
      checkBox.setOpaque(true);
      checkBox.setBorder(noFocusBorder);
    }
Exemplo n.º 27
0
  public BooleanProperty(String description, String label) {
    super();
    this.description = description;
    this.label = label;
    mCheckBox.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent pE) {
            firePropertyChangeEvent();
          }
        });
  }
Exemplo n.º 28
0
  @Override
  protected JComponent getComponent() {
    myReplaceAllCb.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            restartInplaceIntroduceTemplate();
          }
        });

    return myWholePanel;
  }
  private void connect() {

    editCheck.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent e) {
            if (editCheck.isSelected()) {
              deleteBtn.setEnabled(true);
              centerPanel.add(rtScroll);
            } else {
              deleteBtn.setEnabled(false);
              centerPanel.remove(rtScroll);
            }
            dialog.pack();
          }
        });

    deleteBtn.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            delete();
          }
        });

    closeBtn.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            dialog.setVisible(false);
          }
        });

    saveBtn.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              save();
              toUpdate = true;
            } catch (Exception ex) {
            }
          }
        });

    // カレンダによる日付入力を設定する
    PopupListener pl = new PopupListener(dateFld);
  }
Exemplo n.º 30
0
  public ObstacleSettings(final Scene scene, final SceneRenderer renderer) {
    PropertyLayout layout = new PropertyLayout();

    // color
    ColorPanel colorPanel = new ColorPanel("Obstacle Color", scene.view.obstacle.color);
    colorPanel.addListener(
        new ColorPanel.Listener() {
          public void colorChanged(ColorPanel panel, Vec3f newColor) {
            scene.view.obstacle.color.set(newColor);
          }
        });
    layout.add("Color", colorPanel);

    // edge width
    final SpinnerNumberModel widthModel =
        new SpinnerNumberModel(scene.view.obstacle.edgeWidth, 0, 100, 0.01);
    JSpinner widthSpinner = new JSpinner(widthModel);
    widthSpinner.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            scene.view.obstacle.edgeWidth = widthModel.getNumber().floatValue();
            renderer.get2D().getObstacleRenderer().markDirty();
          }
        });
    layout.add("Edge Width", widthSpinner);

    // visibility
    VisibilityWidget visibility =
        new VisibilityWidget(scene.view.obstacle.visible2d, scene.view.obstacle.visible3d);
    visibility.visible3d.setEnabled(false);
    visibility.addListener(
        new VisibilityWidget.Listener() {
          public void visibilityChanged(boolean visible2d, boolean visible3d) {
            scene.view.obstacle.visible2d = visible2d;
          }
        });
    layout.add(visibility);

    // draw origin
    final JCheckBox originCheckBox = new JCheckBox("Draw Origin");
    originCheckBox.setSelected(scene.view.obstacle.originVisible);
    originCheckBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            scene.view.obstacle.originVisible = originCheckBox.isSelected();
            renderer.get2D().getObstacleRenderer().markDirty();
          }
        });
    layout.add(originCheckBox);

    layout.apply(this);
  }