Example usage for javax.swing JCheckBox setText

List of usage examples for javax.swing JCheckBox setText

Introduction

In this page you can find the example usage for javax.swing JCheckBox setText.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The button's text.")
public void setText(String text) 

Source Link

Document

Sets the button's text.

Usage

From source file:org.graphwalker.GUI.App.java

private JCheckBox makeNavigationCheckBoxButton(String imageName, String actionCommand, String toolTipText,
        String altText) {//from w w  w  .j  a v  a 2 s  .co  m
    // Create and initialize the button.
    JCheckBox button = new JCheckBox();
    button.setActionCommand(actionCommand);
    button.setToolTipText(toolTipText);
    button.addActionListener(this);

    button.setText(altText);

    return button;
}

From source file:org.yccheok.jstock.gui.StockJDialog.java

private void initBoardCheckBoxes() {
    final JStock m = JStock.instance();
    final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase();

    boardCheckBoxes.add(jCheckBox1);/* w w  w.  j  a  v a  2s  .  c  om*/
    boardCheckBoxes.add(jCheckBox2);
    boardCheckBoxes.add(jCheckBox21);
    boardCheckBoxes.add(jCheckBox3);
    boardCheckBoxes.add(jCheckBox4);
    boardCheckBoxes.add(jCheckBox23);
    boardCheckBoxes.add(jCheckBox25);
    boardCheckBoxes.add(jCheckBox26);
    boardCheckBoxes.add(jCheckBox27);

    for (JCheckBox checkBox : boardCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards();
    Collections.sort(sortedBoards);

    int count = 0;
    for (Board board : sortedBoards) {
        if (count >= boardCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + boardCheckBoxes.size()
                    + ") to hold board (" + sortedBoards.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++);
        checkBox.setText(board.toString());
        checkBox.setVisible(true);
        checkBoxToBoard.put(checkBox, board);
    }
}

From source file:org.yccheok.jstock.gui.StockJDialog.java

private void initIndustryCheckBoxes() {
    final JStock m = JStock.instance();
    final StockInfoDatabase stockInfoDatabase = m.getStockInfoDatabase();

    industryCheckBoxes.add(jCheckBox5);/* w w  w . j a v  a2  s .c o  m*/
    industryCheckBoxes.add(jCheckBox7);
    industryCheckBoxes.add(jCheckBox9);
    industryCheckBoxes.add(jCheckBox6);
    industryCheckBoxes.add(jCheckBox8);
    industryCheckBoxes.add(jCheckBox10);
    industryCheckBoxes.add(jCheckBox11);
    industryCheckBoxes.add(jCheckBox12);
    industryCheckBoxes.add(jCheckBox13);
    industryCheckBoxes.add(jCheckBox14);
    industryCheckBoxes.add(jCheckBox15);
    industryCheckBoxes.add(jCheckBox16);
    industryCheckBoxes.add(jCheckBox17);
    industryCheckBoxes.add(jCheckBox18);
    industryCheckBoxes.add(jCheckBox22);
    industryCheckBoxes.add(jCheckBox19);
    industryCheckBoxes.add(jCheckBox20);
    industryCheckBoxes.add(jCheckBox24);

    for (JCheckBox checkBox : industryCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries();
    Collections.sort(sortedIndustries);

    int count = 0;
    for (Industry industry : sortedIndustries) {
        if (count >= industryCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + industryCheckBoxes.size()
                    + ") to hold industry (" + sortedIndustries.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++);
        checkBox.setText(industry.toString());
        checkBox.setVisible(true);
        checkBoxToIndustry.put(checkBox, industry);
    }
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

private void initBoardCheckBoxes(StockInfoDatabase stockInfoDatabase) {
    boardCheckBoxes.add(jCheckBox1);//ww w  . j av a2s . co m
    boardCheckBoxes.add(jCheckBox2);
    boardCheckBoxes.add(jCheckBox21);
    boardCheckBoxes.add(jCheckBox3);
    boardCheckBoxes.add(jCheckBox4);
    boardCheckBoxes.add(jCheckBox23);
    boardCheckBoxes.add(jCheckBox25);
    boardCheckBoxes.add(jCheckBox26);
    boardCheckBoxes.add(jCheckBox27);

    for (JCheckBox checkBox : boardCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Board> sortedBoards = stockInfoDatabase.getBoards();
    Collections.sort(sortedBoards);

    int count = 0;
    for (Board board : sortedBoards) {
        if (count >= boardCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + boardCheckBoxes.size()
                    + ") to hold board (" + sortedBoards.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = boardCheckBoxes.get(count++);
        checkBox.setText(board.toString());
        checkBox.setVisible(true);
        checkBoxToBoard.put(checkBox, board);
    }
}

From source file:org.yccheok.jstock.gui.WizardSelectStockJPanel.java

private void initIndustryCheckBoxes(StockInfoDatabase stockInfoDatabase) {
    industryCheckBoxes.add(jCheckBox5);/*  w w w .  j ava2 s  .c  o  m*/
    industryCheckBoxes.add(jCheckBox7);
    industryCheckBoxes.add(jCheckBox9);
    industryCheckBoxes.add(jCheckBox6);
    industryCheckBoxes.add(jCheckBox8);
    industryCheckBoxes.add(jCheckBox10);
    industryCheckBoxes.add(jCheckBox11);
    industryCheckBoxes.add(jCheckBox12);
    industryCheckBoxes.add(jCheckBox13);
    industryCheckBoxes.add(jCheckBox14);
    industryCheckBoxes.add(jCheckBox15);
    industryCheckBoxes.add(jCheckBox16);
    industryCheckBoxes.add(jCheckBox17);
    industryCheckBoxes.add(jCheckBox18);
    industryCheckBoxes.add(jCheckBox22);
    industryCheckBoxes.add(jCheckBox19);
    industryCheckBoxes.add(jCheckBox20);
    industryCheckBoxes.add(jCheckBox24);

    for (JCheckBox checkBox : industryCheckBoxes) {
        checkBox.setVisible(false);
    }

    java.util.List<Industry> sortedIndustries = stockInfoDatabase.getIndustries();
    Collections.sort(sortedIndustries);

    int count = 0;
    for (Industry industry : sortedIndustries) {
        if (count >= industryCheckBoxes.size()) {
            log.error("You do not have enough check box components (" + industryCheckBoxes.size()
                    + ") to hold industry (" + sortedIndustries.size() + ")");
            break;
        }

        javax.swing.JCheckBox checkBox = industryCheckBoxes.get(count++);
        checkBox.setText(industry.toString());
        checkBox.setVisible(true);
        checkBoxToIndustry.put(checkBox, industry);
    }
}

From source file:pcgen.gui2.dialog.ExportDialog.java

private void maybeOpenFile(File file) {
    UIPropertyContext context = UIPropertyContext.getInstance();
    String value = context.getProperty(UIPropertyContext.ALWAYS_OPEN_EXPORT_FILE);
    Boolean openFile = StringUtils.isEmpty(value) ? null : Boolean.valueOf(value);
    if (openFile == null) {
        JCheckBox checkbox = new JCheckBox();
        checkbox.setText("Always perform this action");

        JPanel message = PCGenFrame.buildMessageLabelPanel("Do you want to open " + file.getName() + "?",
                checkbox);/*from  w  ww  .ja  v  a  2  s. c  o  m*/
        int ret = JOptionPane.showConfirmDialog(this, message, "Select an Option", JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE);
        if (ret == JOptionPane.CLOSED_OPTION) {
            return;
        }
        openFile = BooleanUtils.toBoolean(ret, JOptionPane.YES_OPTION, JOptionPane.NO_OPTION);
        if (checkbox.isSelected()) {
            context.setBoolean(UIPropertyContext.ALWAYS_OPEN_EXPORT_FILE, openFile);
        }
    }
    if (!openFile) {
        return;
    }

    if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
        pcgenFrame.showErrorMessage("Cannot Open " + file.getName(),
                "Operating System does not support this operation");
        return;
    }
    try {
        Desktop.getDesktop().open(file);
    } catch (IOException ex) {
        String message = "Failed to open " + file.getName();
        pcgenFrame.showErrorMessage(Constants.APPLICATION_NAME, message);
        Logging.errorPrint(message, ex);
    }
}