Example usage for javax.swing Box createRigidArea

List of usage examples for javax.swing Box createRigidArea

Introduction

In this page you can find the example usage for javax.swing Box createRigidArea.

Prototype

public static Component createRigidArea(Dimension d) 

Source Link

Document

Creates an invisible component that's always the specified size.

Usage

From source file:org.forester.archaeopteryx.ControlPanel.java

void addSecondLevelJCheckBox(final JCheckBox jcb, final JPanel p) {
    jcb.setFocusPainted(false);/*from   w w w . j  a v  a2s.  c om*/
    jcb.setFont(ControlPanel.jcb_font);
    if (!_configuration.isUseNativeUI()) {
        jcb.setBackground(ControlPanel.jcb_background_color);
        jcb.setForeground(ControlPanel.jcb_text_color);
    }
    Box box = Box.createHorizontalBox();
    p.setBackground(background_color);
    box.add(Box.createRigidArea(new Dimension(12, 0)));
    jcb.setVisible(_color_branches_cb.isSelected());
    box.add(jcb);
    p.add(box, "Center");
    jcb.addActionListener(this);
}

From source file:org.processmining.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Initializes the selectionPanel: Fills one combobox with all transitions
 * and places of the used Petri net, and one combobox with only transitions.
 * Initially nothing is selected in both comboboxes and the second combobox
 * is disabled.//  www.j a  va  2s . c om
 */
private void initializeSelection() {
    sb1 = new JComboBox();
    sb1.setMaximumSize(new Dimension(200, 20));
    // SteppedComboBoxUI allows the pop-up menu to be of different width
    // than the width of the combobox, here sb1, itself
    sb1.setUI(new SteppedComboBoxUI());
    sb1.setBorder(BorderFactory.createEtchedBorder());
    sb2 = new JComboBox();
    sb2.setUI(new SteppedComboBoxUI());
    sb2.setMaximumSize(new Dimension(200, 20));
    sb2.setBorder(BorderFactory.createEtchedBorder());

    // Fill the boxes
    sb1.addItem("-------------");
    sb2.addItem("-------------");
    // add all places of the Petri net to the first selection box
    Iterator it = extendedPetriNet.getPlaces().iterator();
    while (it.hasNext()) {
        Element current = (Element) it.next();
        ExtendedPlace ep = (ExtendedPlace) current;
        String placeString = "Place - " + ep.getIdentifier();
        sb1.addItem(placeString);
        if (boxMap.get(placeString) == null) {
            // and add the place to the boxMap if it is not already in it
            boxMap.put(placeString, current);
        }
    }
    // add all transitions of the Petri net to both selection boxes
    Iterator dit = extendedPetriNet.getTransitions().iterator();
    while (dit.hasNext()) {
        Element current = (Element) dit.next();
        ExtendedTransition et = (ExtendedTransition) current;
        try {
            String transString = "Transition - " + et.getLogEvent().getModelElementName() + " "
                    + et.getLogEvent().getEventType();

            if (boxMap.get(transString) == null) {
                // place transition in sb1 & sb2
                sb1.addItem(transString);
                sb2.addItem(transString);
                // and add the transition to the boxMap
                boxMap.put(transString, current);
            } else {
                // at least one transition with the same name within the
                // boxMap
                // count the number of transitions in the boxMap having this
                // same name
                Iterator keys = boxMap.keySet().iterator();
                int number = 0;
                while (keys.hasNext()) {
                    String key = (String) keys.next();
                    if (key.startsWith(transString)) {
                        number++;
                    }
                }
                // add current transition to the boxMap, with between
                // brackets
                // its number (>=1)
                transString = "Transition - " + et.getLogEvent().getModelElementName() + " (" + number + ") "
                        + " " + et.getLogEvent().getEventType();
                // place transition in sb1 & sb2
                sb1.addItem(transString);
                sb2.addItem(transString);
                boxMap.put(transString, current);
            }
        } catch (NullPointerException ne) {
            /*
             * Invisible transitions do not have a ModelElementName or
             * EventType, thus an exception occurs. It is caught here
             */
        }
    }
    // place objects on the selectionPanel
    selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.Y_AXIS));
    selectionPanel.add(Box.createRigidArea(new Dimension(15, 10)));
    selectLabel.setFont(new Font("SansSerif", Font.BOLD, 14));
    selectionPanel.add(selectLabel);
    selectionPanel.add(Box.createRigidArea(new Dimension(5, 5)));
    selectionPanel.add(sb1);
    selectionPanel.add(Box.createRigidArea(new Dimension(5, 10)));
    andLabel.setForeground(Color.GRAY);
    selectionPanel.add(andLabel);
    selectionPanel.add(Box.createRigidArea(new Dimension(5, 5)));
    sb1.setBackground(Color.white);
    sb2.setBackground(Color.white);
    sb2.setEnabled(false);
    selectionPanel.add(sb2);
    selectionPanel.setBackground(new Color(220, 220, 220));
    selectLabel.setAlignmentX(LEFT_ALIGNMENT);
    sb1.setAlignmentX(LEFT_ALIGNMENT);
    andLabel.setAlignmentX(LEFT_ALIGNMENT);
    sb2.setAlignmentX(LEFT_ALIGNMENT);
    selectionPanel.setBorder(BorderFactory.createEtchedBorder());
    selectionPanel.setPreferredSize(new Dimension(240, 140));
    selectionPanel.setMinimumSize(new Dimension(240, 140));
}

From source file:org.forester.archaeopteryx.ControlPanel.java

void addSecondLevelJCheckBoxWithSlider(final JCheckBox jcb, final JPanel p) {
    jcb.setFocusPainted(false);//  w  w  w . j  a va 2  s. c o m
    jcb.setFont(ControlPanel.jcb_font);
    if (!_configuration.isUseNativeUI()) {
        jcb.setBackground(ControlPanel.jcb_background_color);
        jcb.setForeground(ControlPanel.jcb_text_color);
    }
    Box box = Box.createHorizontalBox();
    p.setBackground(background_color);
    box.add(Box.createRigidArea(new Dimension(12, 0)));
    jcb.setVisible(_color_branches_cb.isSelected());
    box.add(jcb);
    buildJSlider(60, _slider_min, _slider_max);
    getColorBranchesEdplSlider().setVisible(_color_branches_cb.isSelected());
    getColorBranchesEdplSlider().setEnabled(_color_branches_edpl.isSelected());
    box.add(getColorBranchesEdplSlider());
    p.add(box, "Center");
    jcb.addActionListener(this);
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphColumnPane() {
    JPanel colPanel = new JPanel();
    colPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));

    JLabel label = new JLabel(JMeterUtils.getResString("aggregate_graph_columns_to_display")); //$NON-NLS-1$
    colPanel.add(label);/*from w  w  w  .  j  a v  a2s .  co m*/
    for (BarGraph bar : eltList) {
        colPanel.add(bar.getChkBox());
        colPanel.add(createColorBarButton(bar, eltList.indexOf(bar)));
    }
    colPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    chooseForeColor.setFont(FONT_SMALL);
    colPanel.add(chooseForeColor);
    chooseForeColor.addActionListener(this);

    JPanel optionsPanel = new JPanel();
    optionsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    optionsPanel.add(createGraphFontValuePane());
    optionsPanel.add(drawOutlinesBar);
    optionsPanel.add(numberShowGrouping);
    optionsPanel.add(valueLabelsVertical);

    JPanel barPane = new JPanel(new BorderLayout());
    barPane.add(colPanel, BorderLayout.NORTH);
    barPane.add(Box.createRigidArea(new Dimension(0, 3)), BorderLayout.CENTER);
    barPane.add(optionsPanel, BorderLayout.SOUTH);

    JPanel columnPane = new JPanel(new BorderLayout());
    columnPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_column_settings"))); // $NON-NLS-1$
    columnPane.add(barPane, BorderLayout.NORTH);
    columnPane.add(Box.createRigidArea(new Dimension(0, 3)), BorderLayout.CENTER);
    columnPane.add(createGraphSelectionSubPane(), BorderLayout.SOUTH);

    return columnPane;
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private JPanel createToolBar(int chip) {
    JPanel bar = new JPanel();

    bar.setLayout(new ModifiedFlowLayout(FlowLayout.LEFT, 0, 0));

    loadButton[chip] = makeButton("load", COMMAND_IMAGE_LOAD[chip],
            "Load " + Constants.CHIP_LABEL[chip] + " image", "Load");
    bar.add(loadButton[chip]);/*ww w.  j  a  v  a2s  . com*/

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    playButton[chip] = makeButton("play", COMMAND_EMULATOR_PLAY[chip],
            "Start or resume " + Constants.CHIP_LABEL[chip] + " emulator", "Play");
    bar.add(playButton[chip]);
    debugButton[chip] = makeButton("debug", COMMAND_EMULATOR_DEBUG[chip],
            "Debug " + Constants.CHIP_LABEL[chip] + " emulator", "Debug");
    bar.add(debugButton[chip]);
    pauseButton[chip] = makeButton("pause", COMMAND_EMULATOR_PAUSE[chip],
            "Pause " + Constants.CHIP_LABEL[chip] + " emulator", "Pause");
    bar.add(pauseButton[chip]);
    stepButton[chip] = makeButton("step", COMMAND_EMULATOR_STEP[chip],
            "Step " + Constants.CHIP_LABEL[chip] + " emulator", "Step");
    bar.add(stepButton[chip]);
    stopButton[chip] = makeButton("stop", COMMAND_EMULATOR_STOP[chip],
            "Stop " + Constants.CHIP_LABEL[chip] + " emulator and reset", "Stop");
    bar.add(stopButton[chip]);

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    breakpointButton[chip] = makeButton("breakpoint", COMMAND_SETUP_BREAKPOINTS[chip],
            "Setup " + Constants.CHIP_LABEL[chip] + " breakpoints", "Breakpoints");
    bar.add(breakpointButton[chip]);

    bar.add(Box.createRigidArea(new Dimension(10, 0)));
    bar.add(new JLabel("Sleep :"));
    bar.add(Box.createRigidArea(new Dimension(10, 0)));
    bar.add(makeSlider(chip));
    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    cpuStateButton[chip] = makeButton("cpu", COMMAND_TOGGLE_CPUSTATE_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " CPU state window", "CPU");
    bar.add(cpuStateButton[chip]);
    memoryHexEditorButton[chip] = makeButton("memory_editor", COMMAND_TOGGLE_MEMORY_HEX_EDITOR[chip],
            Constants.CHIP_LABEL[chip] + " memory hex editor", "Hex Editor");
    bar.add(memoryHexEditorButton[chip]);
    interruptControllerButton[chip] = makeButton("interrupt", COMMAND_TOGGLE_INTERRUPT_CONTROLLER_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " interrupt controller", "Interrupt");
    bar.add(interruptControllerButton[chip]);
    programmableTimersButton[chip] = makeButton("timer", COMMAND_TOGGLE_PROGRAMMABLE_TIMERS_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " programmable timers", "Programmable timers");
    bar.add(programmableTimersButton[chip]);
    serialInterfacesButton[chip] = makeButton("serial", COMMAND_TOGGLE_SERIAL_INTERFACES[chip],
            Constants.CHIP_LABEL[chip] + " serial interfaces", "Serial interfaces");
    bar.add(serialInterfacesButton[chip]);
    ioPortsButton[chip] = makeButton("io", COMMAND_TOGGLE_IO_PORTS_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " I/O Ports", "I/O Ports");
    bar.add(ioPortsButton[chip]);

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    if (chip == Constants.CHIP_FR) {
        screenEmulatorButton = makeButton("screen", COMMAND_TOGGLE_SCREEN_EMULATOR, "Screen emulator",
                "Screen");
        bar.add(screenEmulatorButton);
        component4006Button = makeButton("4006", COMMAND_TOGGLE_COMPONENT_4006_WINDOW, "Component 4006",
                "Component 4006");
        bar.add(component4006Button);
    } else {
        serialDevicesButton[Constants.CHIP_TX] = makeButton("serial_devices",
                COMMAND_TOGGLE_SERIAL_DEVICES[Constants.CHIP_TX],
                Constants.CHIP_LABEL[Constants.CHIP_TX] + " serial devices", "Serial devices");
        bar.add(serialDevicesButton[Constants.CHIP_TX]);
        adConverterButton[Constants.CHIP_TX] = makeButton("ad_converter",
                COMMAND_TOGGLE_AD_CONVERTER[Constants.CHIP_TX],
                Constants.CHIP_LABEL[Constants.CHIP_TX] + " A/D converter", "A/D converter");
        bar.add(adConverterButton[Constants.CHIP_TX]);
        frontPanelButton = makeButton("front_panel", COMMAND_TOGGLE_FRONT_PANEL, "Front Panel", "Front Panel");
        bar.add(frontPanelButton);
    }

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    disassemblyButton[chip] = makeButton("disassembly_log", COMMAND_TOGGLE_DISASSEMBLY_WINDOW[chip],
            "Real time " + Constants.CHIP_LABEL[chip] + " disassembly log", "Disassembly");
    bar.add(disassemblyButton[chip]);
    memoryActivityViewerButton[chip] = makeButton("memory_activity",
            COMMAND_TOGGLE_MEMORY_ACTIVITY_VIEWER[chip], Constants.CHIP_LABEL[chip] + " memory activity viewer",
            "Activity");
    bar.add(memoryActivityViewerButton[chip]);
    customMemoryRangeLoggerButton[chip] = makeButton("custom_logger", COMMAND_TOGGLE_CUSTOM_LOGGER_WINDOW[chip],
            "Custom " + Constants.CHIP_LABEL[chip] + " logger", "Custom logger");
    bar.add(customMemoryRangeLoggerButton[chip]);
    callStackButton[chip] = makeButton("call_stack", COMMAND_TOGGLE_CALL_STACK_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " call stack logger window", "CallStack");
    bar.add(callStackButton[chip]);
    iTronObjectButton[chip] = makeButton("os", COMMAND_TOGGLE_ITRON_OBJECT_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " ITRON object window", "ITRON Object");
    bar.add(iTronObjectButton[chip]);

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    analyseButton[chip] = makeButton("analyse", COMMAND_ANALYSE_DISASSEMBLE[chip],
            Constants.CHIP_LABEL[chip] + " Analyse/Disassemble", "Analyse");
    bar.add(analyseButton[chip]);
    codeStructureButton[chip] = makeButton("code_structure", COMMAND_TOGGLE_CODE_STRUCTURE_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " Code Structure", "Structure");
    bar.add(codeStructureButton[chip]);
    sourceCodeButton[chip] = makeButton("source", COMMAND_TOGGLE_SOURCE_CODE_WINDOW[chip],
            Constants.CHIP_LABEL[chip] + " Source code", "Source");
    bar.add(sourceCodeButton[chip]);

    bar.add(Box.createHorizontalGlue());

    saveLoadMemoryButton[chip] = makeButton("save_load_memory", COMMAND_SAVE_LOAD_MEMORY[chip],
            "Save/Load " + Constants.CHIP_LABEL[chip] + " memory area", "Save/Load memory");
    bar.add(saveLoadMemoryButton[chip]);

    bar.add(Box.createRigidArea(new Dimension(10, 0)));

    chipOptionsButton[chip] = makeButton("options", COMMAND_CHIP_OPTIONS[chip],
            Constants.CHIP_LABEL[chip] + " options", "Options");
    bar.add(chipOptionsButton[chip]);

    return bar;
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphSelectionSubPane() {
    // Search field
    JPanel searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
    searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));

    searchPanel.add(columnSelection);//  ww  w  .  j  av  a  2  s  . c o  m
    columnMatchLabel.setEnabled(false);
    applyFilterBtn.setEnabled(false);
    caseChkBox.setEnabled(false);
    regexpChkBox.setEnabled(false);
    columnSelection.addActionListener(this);

    searchPanel.add(columnMatchLabel);
    searchPanel.add(Box.createRigidArea(new Dimension(5, 0)));

    // Button
    applyFilterBtn.setFont(FONT_SMALL);
    applyFilterBtn.addActionListener(this);
    searchPanel.add(applyFilterBtn);

    // checkboxes
    caseChkBox.setFont(FONT_SMALL);
    searchPanel.add(caseChkBox);
    regexpChkBox.setFont(FONT_SMALL);
    searchPanel.add(regexpChkBox);

    return searchPanel;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphSelectionSubPane() {
    // Search field
    JPanel searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
    searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));

    searchPanel.add(samplerSelection);/*  w  w  w.ja v a 2s.  c  o  m*/
    samplerMatchLabel.setEnabled(false);
    applyFilterBtn.setEnabled(false);
    caseChkBox.setEnabled(false);
    regexpChkBox.setEnabled(false);
    samplerSelection.addActionListener(this);

    searchPanel.add(samplerMatchLabel);
    searchPanel.add(Box.createRigidArea(new Dimension(5, 0)));

    // Button
    applyFilterBtn.setFont(FONT_SMALL);
    applyFilterBtn.addActionListener(this);
    searchPanel.add(applyFilterBtn);

    // checkboxes
    caseChkBox.setFont(FONT_SMALL);
    searchPanel.add(caseChkBox);
    regexpChkBox.setFont(FONT_SMALL);
    searchPanel.add(regexpChkBox);

    return searchPanel;
}

From source file:org.pdfsam.guiclient.commons.panels.JVisualPdfPageSelectionPanel.java

/**
 * Add a component on the left of the top panel
 * @param c//ww  w  .  ja v  a  2s. c o m
 */
public void addToTopPanel(Component c) {
    topPanel.removeAll();
    /*TODO fix this*/
    if (c != null) {
        topPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        topPanel.add(c);
    }
    if (topPanelStyle >= STYLE_TOP_PANEL_FULL) {
        topPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        topPanel.add(loadFileButton);
    }
    if (topPanelStyle >= STYLE_TOP_PANEL_MEDIUM) {
        topPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        topPanel.add(clearButton);
    }
    topPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    topPanel.add(documentProperties);
    topPanel.add(Box.createHorizontalGlue());
    topPanel.add(zoomInButton);
    topPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    topPanel.add(zoomOutButton);
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphDimensionPane() {
    JPanel dimensionPane = new JPanel();
    dimensionPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    dimensionPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_dimension"))); // $NON-NLS-1$

    dimensionPane.add(dynamicGraphSize);
    dynamicGraphSize.setSelected(true); // default option
    graphWidth.setEnabled(false);//  w  ww .  j a v a2 s . c  om
    graphHeight.setEnabled(false);
    dynamicGraphSize.addActionListener(this);
    dimensionPane.add(Box.createRigidArea(new Dimension(10, 0)));
    dimensionPane.add(graphWidth);
    dimensionPane.add(Box.createRigidArea(new Dimension(5, 0)));
    dimensionPane.add(graphHeight);
    return dimensionPane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphDimensionPane() {
    JPanel dimensionPane = new JPanel();
    dimensionPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    dimensionPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_dimension"))); // $NON-NLS-1$

    dimensionPane.add(dynamicGraphSize);
    dynamicGraphSize.setSelected(DEFAULT_DYNAMIC_GRAPH_SIZE);
    graphWidth.setEnabled(false);/*w  ww  . ja v a  2 s.com*/
    graphHeight.setEnabled(false);
    dynamicGraphSize.addActionListener(this);
    dimensionPane.add(Box.createRigidArea(new Dimension(10, 0)));
    dimensionPane.add(graphWidth);
    dimensionPane.add(Box.createRigidArea(new Dimension(5, 0)));
    dimensionPane.add(graphHeight);
    return dimensionPane;
}