Search in sources :

Example 91 with JTabbedPane

use of javax.swing.JTabbedPane in project JMRI by JMRI.

the class VSDConfigDialog method initComponents.

/**
     * Init the GUI components
     */
protected void initComponents() {
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
    // Tabbed pane for loco select (Roster or Manual)
    locoSelectPanel = new JTabbedPane();
    TitledBorder title = BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), Bundle.getMessage("LocoTabbedPaneTitle"));
    title.setTitlePosition(TitledBorder.DEFAULT_POSITION);
    locoSelectPanel.setBorder(title);
    // Roster Tab and Address Tab
    rosterPanel = new JPanel();
    rosterPanel.setLayout(new BoxLayout(rosterPanel, BoxLayout.LINE_AXIS));
    addressPanel = new JPanel();
    addressPanel.setLayout(new BoxLayout(addressPanel, BoxLayout.LINE_AXIS));
    // tab name
    locoSelectPanel.addTab(Bundle.getMessage("RosterLabel"), rosterPanel);
    locoSelectPanel.addTab(Bundle.getMessage("LocoTabbedPaneManualTab"), addressPanel);
    // has the focus.  Oh well.
    try {
        locoSelectPanel.setToolTipTextAt(locoSelectPanel.indexOfTab(Bundle.getMessage("RosterLabel")), Bundle.getMessage("LTPRosterTabToolTip"));
        locoSelectPanel.setMnemonicAt(locoSelectPanel.indexOfTab(Bundle.getMessage("RosterLabel")), Mnemonics.get("RosterTab"));
        locoSelectPanel.setToolTipTextAt(locoSelectPanel.indexOfTab(Bundle.getMessage("LocoTabbedPaneManualTab")), Bundle.getMessage("LTPManualTabToolTip"));
        locoSelectPanel.setMnemonicAt(locoSelectPanel.indexOfTab(Bundle.getMessage("LocoTabbedPaneManualTab")), Mnemonics.get("ManualTab"));
    } catch (IndexOutOfBoundsException iobe) {
        log.debug("Index out of bounds setting up tabbed Pane: " + iobe);
    // Ignore out-of-bounds exception.  We just won't have mnemonics or tool tips this go round.
    }
    // Roster Tab components
    rosterSelector = new RosterEntrySelectorPanel();
    rosterSelector.setNonSelectedItem(Bundle.getMessage("EmptyRosterBox"));
    rosterSelector.setToolTipText(Bundle.getMessage("LTPRosterSelectorToolTip"));
    //rosterComboBox.setToolTipText("tool tip for roster box");
    rosterSelector.addPropertyChangeListener("selectedRosterEntries", new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            rosterItemSelectAction(null);
        }
    });
    rosterPanel.add(rosterSelector);
    rosterLabel = new javax.swing.JLabel();
    rosterLabel.setText(Bundle.getMessage("RosterLabel"));
    // Address Tab Components
    addressLabel = new javax.swing.JLabel();
    addressSelector = new DccLocoAddressSelector();
    addressSelector.setToolTipText(Bundle.getMessage("LTPAddressSelectorToolTip", Bundle.getMessage("ButtonSet")));
    addressSetButton = new javax.swing.JButton();
    addressSetButton.setText(Bundle.getMessage("ButtonSet"));
    addressSetButton.setEnabled(true);
    addressSetButton.setToolTipText(Bundle.getMessage("AddressSetButtonToolTip"));
    addressSetButton.setMnemonic(Mnemonics.get("AddressSet"));
    addressSetButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addressSetButtonActionPerformed(evt);
        }
    });
    addressPanel.add(addressSelector.getCombinedJPanel());
    addressPanel.add(addressSetButton);
    addressPanel.add(addressLabel);
    // Profile select Pane
    profilePanel = new JPanel();
    profilePanel.setLayout(new BoxLayout(profilePanel, BoxLayout.PAGE_AXIS));
    profileComboBox = new javax.swing.JComboBox<>();
    profileComboBox.setToolTipText(Bundle.getMessage("ProfileComboBoxToolTip"));
    profileLabel = new javax.swing.JLabel();
    profileLoadButton = new JButton(Bundle.getMessage("VSDecoderFileMenuLoadVSDFile"));
    profileLoadButton.setToolTipText(Bundle.getMessage("ProfileLoadButtonToolTip"));
    profileLoadButton.setMnemonic(Mnemonics.get("ProfileLoad"));
    profileLoadButton.setEnabled(true);
    TitledBorder title2 = BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), Bundle.getMessage("ProfileSelectorPaneTitle"));
    title.setTitlePosition(TitledBorder.DEFAULT_POSITION);
    profilePanel.setBorder(title2);
    profileComboBox.setModel(new javax.swing.DefaultComboBoxModel<>());
    // Add any already-loaded profile names
    ArrayList<String> sl = VSDecoderManager.instance().getVSDProfileNames();
    if (sl.isEmpty()) {
        profileComboBox.setEnabled(false);
    } else {
        profileComboBox.setEnabled(true);
    }
    updateProfileList(sl);
    profileComboBox.addItem((loadProfilePrompt = new NullProfileBoxItem()));
    profileComboBox.setSelectedItem(loadProfilePrompt);
    profileComboBox.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            profileComboBoxActionPerformed(evt);
        }
    });
    profilePanel.add(profileComboBox);
    profilePanel.add(profileLoadButton);
    profileLoadButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            profileLoadButtonActionPerformed(evt);
        }
    });
    profileLabel.setText(Bundle.getMessage("SoundProfileLabel"));
    rosterSaveButton = new javax.swing.JButton();
    rosterSaveButton.setText(Bundle.getMessage("ConfigSaveButtonLabel"));
    rosterSaveButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            rosterSaveButtonAction(e);
        }
    });
    // temporarily disable this until we update the RosterEntry
    rosterSaveButton.setEnabled(false);
    rosterSaveButton.setToolTipText(Bundle.getMessage("RosterSaveButtonToolTip"));
    rosterSaveButton.setMnemonic(Mnemonics.get("RosterSave"));
    JPanel cbPanel = new JPanel();
    closeButton = new JButton(Bundle.getMessage("ButtonOK"));
    closeButton.setEnabled(false);
    closeButton.setToolTipText(Bundle.getMessage("CD_CloseButtonToolTip"));
    closeButton.setMnemonic(Mnemonics.get("CloseButton"));
    closeButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            closeButtonActionPerformed(e);
        }
    });
    JButton cancelButton = new JButton(Bundle.getMessage("ButtonCancel"));
    cancelButton.setToolTipText(Bundle.getMessage("CD_CancelButtonToolTip"));
    cancelButton.setMnemonic(Mnemonics.get("CancelButton"));
    cancelButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });
    cbPanel.add(cancelButton);
    cbPanel.add(rosterSaveButton);
    cbPanel.add(closeButton);
    this.add(locoSelectPanel);
    this.add(profilePanel);
    //this.add(rosterSaveButton);
    this.add(cbPanel);
    this.pack();
    this.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) DccLocoAddressSelector(jmri.jmrit.DccLocoAddressSelector) ActionListener(java.awt.event.ActionListener) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) TitledBorder(javax.swing.border.TitledBorder) RosterEntrySelectorPanel(jmri.jmrit.roster.swing.RosterEntrySelectorPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) JButton(javax.swing.JButton) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener)

Example 92 with JTabbedPane

use of javax.swing.JTabbedPane in project JMRI by JMRI.

the class Ds64TabbedPanel method initComponents.

@Override
public void initComponents() {
    super.initComponents();
    // implements an AbstractBoardProgPanel with three tabs:
    //      Outputs tab - configure features most related to DS64 outputs
    //      Inputs tab - configure features most related to DS64 inputs
    //      Routes tab - configure features related to routes
    //          Routes tab has sub-tabs, one for each of the 8 routes
    addrField.setText(Bundle.getMessage("LABEL_UNIT_ADDRESS"));
    String[] outputTypes = { Bundle.getMessage("ComboBoxOutputType0"), Bundle.getMessage("ComboBoxOutputType1") };
    outputTypeLabel = new JLabel(Bundle.getMessage("LabelOutputType"));
    // opSw 1
    outputType = new JComboBox<>(outputTypes);
    outputType.setToolTipText(Bundle.getMessage("ToolTipOutputType"));
    outputType.addActionListener(basicConfigChangeActionListener);
    // NOI18N
    outputType.setName("1");
    String[] availableDelayTimes = new String[16];
    availableDelayTimes[0] = Bundle.getMessage("ComboBoxPulseTime0point1");
    availableDelayTimes[1] = Bundle.getMessage("ComboBoxPulseTime0point2");
    availableDelayTimes[2] = Bundle.getMessage("ComboBoxPulseTime0point4");
    availableDelayTimes[3] = Bundle.getMessage("ComboBoxPulseTime0point6");
    availableDelayTimes[4] = Bundle.getMessage("ComboBoxPulseTime0point8");
    availableDelayTimes[5] = Bundle.getMessage("ComboBoxPulseTime1point0");
    availableDelayTimes[6] = Bundle.getMessage("ComboBoxPulseTime1point2");
    availableDelayTimes[7] = Bundle.getMessage("ComboBoxPulseTime1point4");
    availableDelayTimes[8] = Bundle.getMessage("ComboBoxPulseTime1point6");
    availableDelayTimes[9] = Bundle.getMessage("ComboBoxPulseTime1point8");
    availableDelayTimes[10] = Bundle.getMessage("ComboBoxPulseTime2point0");
    availableDelayTimes[11] = Bundle.getMessage("ComboBoxPulseTime2point2");
    availableDelayTimes[12] = Bundle.getMessage("ComboBoxPulseTime2point4");
    availableDelayTimes[13] = Bundle.getMessage("ComboBoxPulseTime2point6");
    availableDelayTimes[14] = Bundle.getMessage("ComboBoxPulseTime2point8");
    availableDelayTimes[15] = Bundle.getMessage("ComboBoxPulseTime3point0");
    // opSws 2-5
    delayTimeLabel = new JLabel(Bundle.getMessage("LabelPulseTimeout"));
    delayTime = new JComboBox<>(availableDelayTimes);
    delayTime.setToolTipText(Bundle.getMessage("ToolTipPulseTimeout"));
    // NOI18N
    delayTime.setName("2345");
    delayTime.addActionListener(basicConfigChangeActionListener);
    String[] initialOutputStates = { Bundle.getMessage("ComboBoxOutputPowerupType0"), Bundle.getMessage("ComboBoxOutputPowerupType1") };
    outputStatesLabel = new JLabel(Bundle.getMessage("LabelPowerUpOutputActivity"));
    // opsw 6
    outputStates = new JComboBox<>(initialOutputStates);
    outputStates.setToolTipText(Bundle.getMessage("ToolTipOutputStates"));
    // NOI18N
    outputStates.setName("6");
    outputStates.addActionListener(basicConfigChangeActionListener);
    String[] startupDelays = { Bundle.getMessage("ComboBoxOutputPowerupDelayType0"), Bundle.getMessage("ComboBoxOutputPowerupDelayType1") };
    startupDelayLabel = new JLabel(Bundle.getMessage("LabelInitialPowerUpDelay"));
    // opsw 8
    startupDelay = new JComboBox<>(startupDelays);
    startupDelay.setToolTipText(Bundle.getMessage("ToolTipStartupDelay"));
    // NOI18N
    startupDelay.setName("8");
    startupDelay.addActionListener(basicConfigChangeActionListener);
    String[] staticOutputShutoffs = { Bundle.getMessage("ComboBoxOutputPowerManagementType0"), Bundle.getMessage("ComboBoxOutputPowerManagementType1") };
    staticOutputShutoffLabel = new JLabel(Bundle.getMessage("LabelOutputPowerManagementStyle"));
    // opSw 9
    staticOutputShutoff = new JComboBox<>(staticOutputShutoffs);
    staticOutputShutoff.setToolTipText(Bundle.getMessage("ToolTipLabelOutputPowerManagementStyle"));
    // NOI18N
    staticOutputShutoff.setName("9");
    staticOutputShutoff.addActionListener(basicConfigChangeActionListener);
    // command sources
    String[] commandTypes = { Bundle.getMessage("ComboBoxCommandsRecognizedFromType0"), Bundle.getMessage("ComboBoxCommandsRecognizedFromType1") };
    commandTypeLabel = new JLabel(Bundle.getMessage("LabelAcceptedSwitchCommandTypes"));
    //opSw 10
    commandType = new JComboBox<>(commandTypes);
    commandType.setToolTipText(Bundle.getMessage("ToolTipLabelAcceptedSwitchCommandTypes"));
    // NOI18N
    commandType.setName("10");
    commandType.addActionListener(basicConfigChangeActionListener);
    String[] commandSources = { Bundle.getMessage("ComboBoxCommandSourceType0"), Bundle.getMessage("ComboBoxCommandSourceType1") };
    commandSourceLabel = new JLabel(Bundle.getMessage("LabelAcceptSwitchCommandsFrom"));
    // opSw14
    commandSource = new JComboBox<>(commandSources);
    commandSource.setToolTipText(Bundle.getMessage("ToolTipCommandSource"));
    // NOI18N
    commandSource.setName("14");
    commandSource.addActionListener(basicConfigChangeActionListener);
    // Crossbuck Flasher controls
    output1CrossbuckFlasherCheckBox = new JCheckBox(Bundle.getMessage("CheckBoxOutput1Crossbuck"));
    output1CrossbuckFlasherCheckBox.setToolTipText(Bundle.getMessage("ToolTipCheckBoxOutput1Crossbuck"));
    // NOI18N
    output1CrossbuckFlasherCheckBox.setName("17");
    output1CrossbuckFlasherCheckBox.addActionListener(basicConfigChangeActionListener);
    output2CrossbuckFlasherCheckBox = new JCheckBox(Bundle.getMessage("CheckBoxOutput2Crossbuck"));
    output2CrossbuckFlasherCheckBox.setToolTipText(Bundle.getMessage("ToolTipCheckBoxOutput2Crossbuck"));
    // NOI18N
    output2CrossbuckFlasherCheckBox.setName("18");
    output2CrossbuckFlasherCheckBox.addActionListener(basicConfigChangeActionListener);
    output3CrossbuckFlasherCheckBox = new JCheckBox(Bundle.getMessage("CheckBoxOutput3Crossbuck"));
    output3CrossbuckFlasherCheckBox.setToolTipText(Bundle.getMessage("ToolTipCheckBoxOutput3Crossbuck"));
    // NOI18N
    output3CrossbuckFlasherCheckBox.setName("19");
    output3CrossbuckFlasherCheckBox.addActionListener(basicConfigChangeActionListener);
    output4CrossbuckFlasherCheckBox = new JCheckBox(Bundle.getMessage("CheckBoxOutput4Crossbuck"));
    output4CrossbuckFlasherCheckBox.setToolTipText(Bundle.getMessage("ToolTipCheckBoxOutput4Crossbuck"));
    // NOI18N
    output4CrossbuckFlasherCheckBox.setName("20");
    output4CrossbuckFlasherCheckBox.addActionListener(basicConfigChangeActionListener);
    // DS64 routes
    String[] routesControls = { Bundle.getMessage("ComboBoxEntryRoutesOption0"), Bundle.getMessage("ComboBoxEntryRoutesOption1"), Bundle.getMessage("ComboBoxEntryRoutesOption2"), Bundle.getMessage("ComboBoxEntryRoutesOption3") };
    routesControlLabel = new JLabel(Bundle.getMessage("LabelTriggerDs64Routes"));
    // opSws 11, 16
    routesControl = new JComboBox<>(routesControls);
    routesControl.setToolTipText(Bundle.getMessage("ToolTipLabelRouteControlOptions"));
    // NOI18N
    routesControl.setName("1116");
    routesControl.addActionListener(basicConfigChangeActionListener);
    // local input controls
    String[] localControlOfOutputsStyles = { Bundle.getMessage("ComboBoxInputsControlOutputsType0"), Bundle.getMessage("ComboBoxInputsControlOutputsType1"), Bundle.getMessage("ComboBoxInputsControlOutputsType2"), Bundle.getMessage("comboboxInputsControlOutputsType3") };
    localControlOfOutputsStyleLabel = new JLabel(Bundle.getMessage("LabelLocalInputsControlOutputs"));
    // opSw12
    localControlOfOutputsStyle = new JComboBox<>(localControlOfOutputsStyles);
    localControlOfOutputsStyle.setToolTipText(Bundle.getMessage("ToolTipLocalInputsControl"));
    // NOI18N
    localControlOfOutputsStyle.setName("1215");
    localControlOfOutputsStyle.addActionListener(basicConfigChangeActionListener);
    String[] sensorMessageTriggers = { Bundle.getMessage("ComboBoxInputsCauseMessagesType0"), Bundle.getMessage("ComboBoxInputsCauseMessagesType1") };
    sensorMessageTriggerLabel = new JLabel(Bundle.getMessage("LabelBetweenForMessageTypeSent"));
    // opSw13
    sensorMessageTrigger = new JComboBox<>(sensorMessageTriggers);
    sensorMessageTrigger.setToolTipText(Bundle.getMessage("ToolTipSensorMessageTrigger"));
    // NOI18N
    sensorMessageTrigger.setName("13");
    sensorMessageTrigger.addActionListener(basicConfigChangeActionListener);
    String[] localSensorTypes = { Bundle.getMessage("ComboBoxSensorMessageTypeSentType0"), Bundle.getMessage("ComboBoxSensorMessageTypeSentType1") };
    // opSw21
    localSensorType = new JComboBox<>(localSensorTypes);
    localSensorType.setToolTipText(Bundle.getMessage("ToolTipLocalSensorsType"));
    // NOI18N
    localSensorType.setName("21");
    localSensorType.addActionListener(basicConfigChangeActionListener);
    factoryResetButton = new JToggleButton(Bundle.getMessage("ButtonTextResetToFactoryDefault"));
    factoryResetButton.setToolTipText(Bundle.getMessage("ToolTipButtonTextResetToFactoryDefault"));
    factoryResetButton.addActionListener(event -> {
        readAllButton.setEnabled(false);
        writeAllButton.setEnabled(false);
        resetRouteButton.setEnabled(false);
        boardFactoryReset();
    });
    routesTabbedPane = new JTabbedPane();
    routePanel = new JPanel[9];
    routeTop = new SimpleTurnoutStateEntry[9];
    routeA2 = new SimpleTurnoutStateEntry[9];
    routeA3 = new SimpleTurnoutStateEntry[9];
    routeA4 = new SimpleTurnoutStateEntry[9];
    routeA5 = new SimpleTurnoutStateEntry[9];
    routeA6 = new SimpleTurnoutStateEntry[9];
    routeA7 = new SimpleTurnoutStateEntry[9];
    routeA8 = new SimpleTurnoutStateEntry[9];
    resetRouteButton = new JToggleButton(Bundle.getMessage("ButtonTextResetRoute"));
    resetRouteButton.setToolTipText(Bundle.getMessage("ToolTipButtonTextResetRoute"));
    resetRouteButton.setEnabled(false);
    resetRouteButton.setVisible(false);
    // create read/write buttons, address
    JPanel addressingPanel = provideAddressing(" ");
    readAllButton.setPreferredSize(null);
    readAllButton.setText(Bundle.getMessage("ButtonTextReadFullSheet"));
    readAllButton.setToolTipText(Bundle.getMessage("ToolTipButtonTextReadFullSheet"));
    writeAllButton.setPreferredSize(null);
    writeAllButton.setText(Bundle.getMessage("ButtonTextWriteFullSheet"));
    writeAllButton.setToolTipText(Bundle.getMessage("ToolTipButtonTextWriteFullSheet"));
    // make both buttons a little bit bigger, with identical (preferred) sizes
    // (width increased because some computers/displays trim the button text)
    java.awt.Dimension d = writeAllButton.getPreferredSize();
    int w = d.width;
    d = readAllButton.getPreferredSize();
    if (d.width > w) {
        w = d.width;
    }
    writeAllButton.setPreferredSize(new java.awt.Dimension((int) (w * 1.1), d.height));
    readAllButton.setPreferredSize(new java.awt.Dimension((int) (w * 1.1), d.height));
    addressingPanel.add(resetRouteButton);
    int indexOfTargetBoardAddress = 0;
    addressComboBox = new JComboBox<>();
    for (Integer index = 0; index < boardNumsEntryValue.size(); ++index) {
        if (boardNumsEntryValue.get(index) == origAccessBoardNum) {
            origAccessBoardNum = -1;
            indexOfTargetBoardAddress = index;
        }
        addressComboBox.addItem(boardNumsEntryValue.get(index));
    }
    addressComboBox.setSelectedIndex(indexOfTargetBoardAddress);
    addressingPanel.add(addressComboBox, 1);
    addressingPanel.getComponent(2).setVisible(false);
    addressComboBox.setEditable(true);
    // add read/write buttons, address
    appendLine(addressingPanel);
    generalTabbedPane = new JTabbedPane();
    generalPanel = new JPanel();
    generalPanel.setLayout(new BoxLayout(generalPanel, BoxLayout.Y_AXIS));
    // NOI18N
    generalPanel.setName("Basic Settings");
    JPanel allOutputControls = new JPanel();
    allOutputControls.setLayout(new BoxLayout(allOutputControls, BoxLayout.Y_AXIS));
    javax.swing.border.TitledBorder allOutputControlsTitleBorder;
    javax.swing.border.Border blackline;
    blackline = javax.swing.BorderFactory.createLineBorder(java.awt.Color.black);
    allOutputControlsTitleBorder = javax.swing.BorderFactory.createTitledBorder(blackline, Bundle.getMessage("TitledBorderLabelOutputControls"));
    allOutputControls.setBorder(allOutputControlsTitleBorder);
    JPanel outputTypePanel = new JPanel();
    outputTypePanel.setLayout(new FlowLayout());
    outputTypePanel.add(outputTypeLabel);
    outputTypePanel.add(outputType);
    allOutputControls.add(outputTypePanel);
    JPanel delayTimePanel = new JPanel();
    delayTimePanel.setLayout(new FlowLayout());
    delayTimePanel.add(delayTimeLabel);
    delayTimePanel.add(delayTime);
    allOutputControls.add(delayTimePanel);
    JPanel outputStatePanel = new JPanel();
    outputStatePanel.setLayout(new FlowLayout());
    outputStatePanel.add(outputStatesLabel);
    outputStatePanel.add(outputStates);
    allOutputControls.add(outputStatePanel);
    JPanel startupDelayPanel = new JPanel();
    startupDelayPanel.setLayout(new FlowLayout());
    startupDelayPanel.add(startupDelayLabel);
    startupDelayPanel.add(startupDelay);
    allOutputControls.add(startupDelayPanel);
    JPanel staticOutputShutoffPanel = new JPanel();
    staticOutputShutoffPanel.setLayout(new FlowLayout());
    staticOutputShutoffPanel.add(staticOutputShutoffLabel);
    staticOutputShutoffPanel.add(staticOutputShutoff);
    allOutputControls.add(staticOutputShutoffPanel);
    JPanel crossingGateControls = new JPanel(new java.awt.GridLayout(2, 2));
    crossingGateControls.add(output1CrossbuckFlasherCheckBox);
    crossingGateControls.add(output2CrossbuckFlasherCheckBox);
    crossingGateControls.add(output3CrossbuckFlasherCheckBox);
    crossingGateControls.add(output4CrossbuckFlasherCheckBox);
    allOutputControls.add(crossingGateControls);
    generalPanel.add(allOutputControls);
    // command sources
    JPanel ds64CommandSourcesPanel = new JPanel();
    ds64CommandSourcesPanel.setLayout(new BoxLayout(ds64CommandSourcesPanel, BoxLayout.Y_AXIS));
    javax.swing.border.TitledBorder ds64CommandSourcesTitleBorder;
    ds64CommandSourcesTitleBorder = javax.swing.BorderFactory.createTitledBorder(blackline, Bundle.getMessage("TitledBorderLabelCommandSources"));
    ds64CommandSourcesPanel.setBorder(ds64CommandSourcesTitleBorder);
    JPanel commandTypePanel = new JPanel();
    commandTypePanel.setLayout(new FlowLayout());
    commandTypePanel.add(commandTypeLabel);
    commandTypePanel.add(commandType);
    ds64CommandSourcesPanel.add(commandTypePanel);
    JPanel commandSourcePanel = new JPanel();
    commandSourcePanel.setLayout(new FlowLayout());
    commandSourcePanel.add(commandSourceLabel);
    commandSourcePanel.add(commandSource);
    ds64CommandSourcesPanel.add(commandSourcePanel);
    generalPanel.add(ds64CommandSourcesPanel);
    // DS64 routes
    JPanel localRoutesPanel = new JPanel();
    localRoutesPanel.setLayout(new BoxLayout(localRoutesPanel, BoxLayout.Y_AXIS));
    javax.swing.border.TitledBorder localRoutesTitleBorder;
    localRoutesTitleBorder = javax.swing.BorderFactory.createTitledBorder(blackline, Bundle.getMessage("TitledBorderLabelRoutes"));
    localRoutesPanel.setBorder(localRoutesTitleBorder);
    JPanel routesControlPanel = new JPanel();
    routesControlPanel.setLayout(new FlowLayout());
    routesControlPanel.add(routesControlLabel);
    routesControlPanel.add(routesControl);
    localRoutesPanel.add(routesControlPanel);
    generalPanel.add(localRoutesPanel);
    // local input controls
    localInputControlsPanel = new JPanel();
    localInputControlsPanel.setLayout(new BoxLayout(localInputControlsPanel, BoxLayout.Y_AXIS));
    javax.swing.border.TitledBorder localInputControlsTitleBorder;
    localInputControlsTitleBorder = javax.swing.BorderFactory.createTitledBorder(blackline, Bundle.getMessage("TitledBorderLabelLocalInputControls"));
    localInputControlsPanel.setBorder(localInputControlsTitleBorder);
    JPanel localControlOfOutputsStylePanel = new JPanel(new FlowLayout());
    localControlOfOutputsStylePanel.add(localControlOfOutputsStyleLabel);
    localControlOfOutputsStylePanel.add(localControlOfOutputsStyle);
    localInputControlsPanel.add(localControlOfOutputsStylePanel);
    sensorMessageTriggerPanel = new JPanel(new FlowLayout());
    sensorMessageTriggerPanel.add(localSensorType);
    sensorMessageTriggerPanel.add(sensorMessageTriggerLabel);
    sensorMessageTriggerPanel.add(sensorMessageTrigger);
    localInputControlsPanel.add(sensorMessageTriggerPanel);
    generalPanel.add(localInputControlsPanel);
    generalPanel.add(new JSeparator());
    JPanel factoryResetButtonPanel = new JPanel();
    factoryResetButtonPanel.add(factoryResetButton);
    generalPanel.add(factoryResetButtonPanel);
    generalTabbedPane.addTab(Bundle.getMessage("TabTextBasicSettings"), null, generalPanel, Bundle.getMessage("TabToolTipBasicSettings"));
    // opsws panel
    opswsPanel = new JPanel();
    opswsValues = new JPanel();
    opswsValues.setLayout(new BoxLayout(opswsValues, BoxLayout.Y_AXIS));
    javax.swing.border.TitledBorder opswsValuesTitleBorder;
    opswsValuesTitleBorder = javax.swing.BorderFactory.createTitledBorder(blackline, Bundle.getMessage("TitledBorderLabelOpSws"));
    opswsValues.setBorder(opswsValuesTitleBorder);
    opswsPanel.setLayout(new BoxLayout(opswsPanel, BoxLayout.Y_AXIS));
    JPanel innerPanel;
    ButtonGroup[] g = new ButtonGroup[22];
    opswThrown = new JRadioButtonWithInteger[22];
    opswClosed = new JRadioButtonWithInteger[22];
    for (int i = 1; i <= 21; i++) {
        if (i != 7) {
            log.debug("Creating entry for OpSw " + i);
            innerPanel = new JPanel(new FlowLayout());
            // NOI18N
            innerPanel.add(new JLabel("OpSw " + i));
            opswThrown[i] = new JRadioButtonWithInteger(i, Bundle.getMessage("RadioButtonTextThrown"));
            opswClosed[i] = new JRadioButtonWithInteger(i, Bundle.getMessage("RadioButtonTextClosed"));
            g[i] = new ButtonGroup();
            g[i].add(opswThrown[i]);
            g[i].add(opswClosed[i]);
            innerPanel.add(opswThrown[i]);
            innerPanel.add(opswClosed[i]);
            opswsPanel.add(innerPanel);
            opswsPanel.add(new JSeparator());
            opswThrown[i].addItemListener(event -> {
                if (event.getSource().getClass().equals(JRadioButtonWithInteger.class)) {
                    JRadioButtonWithInteger source = ((JRadioButtonWithInteger) (event.getSource()));
                    int ind = source.index;
                    boolean st = (event.getStateChange() == ItemEvent.DESELECTED);
                    log.debug("ItemEventListener Opsw values: " + ind + " thrown radio button event: " + st + " " + (st ? "Closed" : "Thrown") + ".");
                    opsw[ind] = st;
                }
            });
        }
    }
    opswsValues.add(opswsPanel);
    opswsScrollPane = new JScrollPane(opswsValues);
    opswsScrollPane.setPreferredSize(new java.awt.Dimension(180, 200));
    // NOI18N
    opswsScrollPane.setName("Simple OpSws");
    generalTabbedPane.addTab(Bundle.getMessage("TabTextOpSwValues"), null, opswsScrollPane, Bundle.getMessage("TabToolTipOpSwValues"));
    outputAddrsPanel = new JPanel();
    outputAddrsPanel.setLayout(new BoxLayout(outputAddrsPanel, BoxLayout.Y_AXIS));
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelCautionReadingWritingCanCauseOutputChanges")));
    outputAddrsPanel.add(p);
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelTextOutput1")));
    outAddr1 = new ValidatedTextField(5, false, 1, 2048, Bundle.getMessage("ErrorTextNonBlankAddressInvalid"));
    outState1 = new JLabel(Bundle.getMessage("LabelTurnoutCurrentlyIsUnknown"));
    p.add(outAddr1);
    p.add(outState1);
    outputAddrsPanel.add(p);
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelTextOutput2")));
    outAddr2 = new ValidatedTextField(5, false, 1, 2048, Bundle.getMessage("ErrorTextNonBlankAddressInvalid"));
    outState2 = new JLabel(Bundle.getMessage("LabelTurnoutCurrentlyIsUnknown"));
    p.add(outAddr2);
    p.add(outState2);
    outputAddrsPanel.add(p);
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelTextOutput3")));
    outAddr3 = new ValidatedTextField(5, false, 1, 2048, Bundle.getMessage("ErrorTextNonBlankAddressInvalid"));
    outState3 = new JLabel(Bundle.getMessage("LabelTurnoutCurrentlyIsUnknown"));
    p.add(outAddr3);
    p.add(outState3);
    outputAddrsPanel.add(p);
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelTextOutput4")));
    outAddr4 = new ValidatedTextField(5, false, 1, 2048, Bundle.getMessage("ErrorTextNonBlankAddressInvalid"));
    outState4 = new JLabel(Bundle.getMessage("LabelTurnoutCurrentlyIsUnknown"));
    p.add(outAddr4);
    p.add(outState4);
    outputAddrsPanel.add(p);
    outputAddrsPanel.add(new JSeparator());
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel(Bundle.getMessage("LabelOutputsTabSensorNotes")));
    outputAddrsPanel.add(p);
    generalTabbedPane.addTab(Bundle.getMessage("TabTextOutputAddrs"), null, outputAddrsPanel, Bundle.getMessage("TabToolTipOutputAddrs"));
    routePanel[0] = new JPanel();
    routesTabbedPane.setTabPlacement(JTabbedPane.LEFT);
    // create route panels (one tab each for each of 8 routes)
    for (int i = 1; i <= 8; ++i) {
        routePanel[i] = new JPanel();
        routePanel[i].setLayout(new BoxLayout(routePanel[i], BoxLayout.Y_AXIS));
        routePanel[i].add(new JLabel(Bundle.getMessage("TabTextSpecificRoute", Integer.toString(i))));
        routePanel[i].add(new JSeparator());
        JPanel q = new JPanel(new FlowLayout());
        q.add(new JLabel(Bundle.getMessage("LabelCautionReadingWritingCanCauseOutputChanges")));
        routePanel[i].add(q);
        routePanel[i].add(new JSeparator());
        routeTop[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA2[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA3[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA4[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA5[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA6[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA7[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routeA8[i] = new SimpleTurnoutStateEntry(2048, false, true);
        routePanel[i].add(routeTop[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", Bundle.getMessage("LabelTextRouteXTopTurnout"))));
        routePanel[i].add(routeA2[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 2)));
        routePanel[i].add(routeA3[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 3)));
        routePanel[i].add(routeA4[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 4)));
        routePanel[i].add(routeA5[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 5)));
        routePanel[i].add(routeA6[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 6)));
        routePanel[i].add(routeA7[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 7)));
        routePanel[i].add(routeA8[i].createEntryPanel(Bundle.getMessage("LabelTextRouteXSpecificTurnout", 8)));
        routesTabbedPane.addTab(Bundle.getMessage("TabTextSpecificRoute", Integer.toString(i)), null, routePanel[i], Bundle.getMessage("TabToolTipSpecificRoute", Integer.toString(i)));
    }
    generalTabbedPane.addTab(Bundle.getMessage("TabTextRoutes"), null, routesTabbedPane, Bundle.getMessage("ToolTipTabTextRoutes"));
    resetRouteButton.addActionListener(event -> {
        readAllButton.setEnabled(false);
        writeAllButton.setEnabled(false);
        factoryResetButton.setEnabled(false);
        Integer routeNumber = 0;
        if (((JTabbedPane) generalTabbedPane.getSelectedComponent()) != routesTabbedPane) {
            return;
        }
        if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[1]) {
            routeNumber = 1;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[2]) {
            routeNumber = 2;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[3]) {
            routeNumber = 3;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[4]) {
            routeNumber = 4;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[5]) {
            routeNumber = 5;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[6]) {
            routeNumber = 6;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[7]) {
            routeNumber = 7;
        } else if (((JPanel) routesTabbedPane.getSelectedComponent()) == routePanel[8]) {
            routeNumber = 8;
        }
        if (routeNumber != 0) {
            Object[] dialogBoxButtonOptions = { Bundle.getMessage("ButtonTextResetRouteN", routeNumber), Bundle.getMessage("ButtonTextCancelBoardReset") };
            int userReply = JOptionPane.showOptionDialog(this.getParent(), Bundle.getMessage("DialogTextClearRouteWarning", routeNumber), Bundle.getMessage("DialogHeadingClearRouteWarning"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialogBoxButtonOptions, dialogBoxButtonOptions[1]);
            if (userReply != 0) {
                resetRouteButton.setSelected(false);
                return;
            }
            resetRouteOperation(routeNumber);
        }
        readAllButton.setEnabled(true);
        writeAllButton.setEnabled(true);
        factoryResetButton.setEnabled(true);
        resetRouteButton.setSelected(false);
    });
    appendLine(generalTabbedPane);
    JPanel statusPanel = new JPanel();
    setStatus(" ");
    statusPanel.add(new JSeparator());
    statusPanel.add(provideStatusLine());
    statusPanel.add(new JSeparator());
    appendLine(statusPanel);
    // configure DS64 message type
    setTypeWord(0x73);
    opsw[7] = false;
    operationType = OpSwOpType.BasicsRead;
    routesTabbedPane.addChangeListener(new ChangeListener() {

        // This method is called whenever the selected tab changes
        String route1TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(1));

        String route2TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(2));

        String route3TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(3));

        String route4TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(4));

        String route5TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(5));

        String route6TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(6));

        String route7TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(7));

        String route8TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(8));

        @Override
        public void stateChanged(ChangeEvent evt) {
            unhighlightAllBasicOpSws();
            unhighlightAllOutputEntryFields();
            unhighlightAllRouteEntryFields();
            String activeTabTitle = routesTabbedPane.getTitleAt(routesTabbedPane.getSelectedIndex());
            if ((activeTabTitle.equals(route1TabText)) || (activeTabTitle.equals(route2TabText)) || (activeTabTitle.equals(route3TabText)) || (activeTabTitle.equals(route4TabText)) || (activeTabTitle.equals(route5TabText)) || (activeTabTitle.equals(route6TabText)) || (activeTabTitle.equals(route7TabText)) || (activeTabTitle.equals(route8TabText))) {
                resetRouteButton.setVisible(true);
                resetRouteButton.setEnabled(true);
                resetRouteButton.updateUI();
                readAllButton.setSelected(false);
                readAllButton.updateUI();
                updateUI();
            }
        }
    });
    generalTabbedPane.addChangeListener(new ChangeListener() {

        // This method is called whenever the selected tab changes
        String route1TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(1));

        String route2TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(2));

        String route3TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(3));

        String route4TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(4));

        String route5TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(5));

        String route6TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(6));

        String route7TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(7));

        String route8TabText = Bundle.getMessage("TabTextSpecificRoute", Integer.toString(8));

        String outputsTabText = Bundle.getMessage("TabTextOutputAddrs");

        @Override
        public void stateChanged(ChangeEvent evt) {
            String activeTabTitle;
            unhighlightAllBasicOpSws();
            unhighlightAllOutputEntryFields();
            unhighlightAllRouteEntryFields();
            activeTabTitle = generalTabbedPane.getTitleAt(generalTabbedPane.getSelectedIndex());
            JTabbedPane pane = (JTabbedPane) evt.getSource();
            // Get current tab
            if ((activeTabTitle.equals(Bundle.getMessage("TabTextRoutes")))) {
                activeTabTitle = routesTabbedPane.getTitleAt(routesTabbedPane.getSelectedIndex());
                if ((activeTabTitle.equals(route1TabText)) || (activeTabTitle.equals(route2TabText)) || (activeTabTitle.equals(route3TabText)) || (activeTabTitle.equals(route4TabText)) || (activeTabTitle.equals(route5TabText)) || (activeTabTitle.equals(route6TabText)) || (activeTabTitle.equals(route7TabText)) || (activeTabTitle.equals(route8TabText))) {
                    resetRouteButton.setEnabled(true);
                    resetRouteButton.setVisible(true);
                    readAllButton.setEnabled(true);
                    writeAllButton.setSelected(false);
                    readAllButton.setSelected(false);
                    writeAllButton.setEnabled(true);
                    factoryResetButton.setEnabled(true);
                    routesTabbedPane.updateUI();
                    updateUI();
                } else {
                    routesTabbedPane.setSelectedIndex(0);
                    routesTabbedPane.updateUI();
                }
            } else if (activeTabTitle.equals(outputsTabText)) {
                resetRouteButton.setEnabled(false);
                resetRouteButton.setVisible(false);
                readAllButton.setEnabled(true);
                writeAllButton.setSelected(false);
                readAllButton.setSelected(false);
                writeAllButton.setEnabled(true);
                readAllButton.updateUI();
                updateUI();
            } else {
                readAllButton.setEnabled(true);
                writeAllButton.setEnabled(true);
                writeAllButton.setSelected(false);
                readAllButton.setSelected(false);
                resetRouteButton.setVisible(false);
                resetRouteButton.setEnabled(false);
                readAllButton.updateUI();
                updateUI();
            }
            (pane.getRootPane().getParent()).setPreferredSize(null);
            ((Window) pane.getRootPane().getParent()).pack();
        }
    });
    responseTimer.addActionListener(routeResetResponseTimerListener);
    commandType.setToolTipText(Bundle.getMessage("ToolTipLabelAcceptedSwitchCommandTypes"));
    updateBasicOpSwTab();
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JTabbedPane(javax.swing.JTabbedPane) BoxLayout(javax.swing.BoxLayout) JSeparator(javax.swing.JSeparator) JToggleButton(javax.swing.JToggleButton) ChangeListener(javax.swing.event.ChangeListener) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) JCheckBox(javax.swing.JCheckBox) ValidatedTextField(jmri.util.swing.ValidatedTextField) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup)

Example 93 with JTabbedPane

use of javax.swing.JTabbedPane in project JMRI by JMRI.

the class ProfilePreferencesPanel method initComponents.

/**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    profilesPopupMenu = new JPopupMenu();
    renameMI = new JMenuItem();
    jSeparator1 = new JPopupMenu.Separator();
    copyMI = new JMenuItem();
    deleteMI = new JMenuItem();
    grpStartWithSelectors = new ButtonGroup();
    jTabbedPane1 = new JTabbedPane();
    enabledPanel = new JPanel();
    jScrollPane1 = new JScrollPane();
    profilesTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    btnOpenExistingProfile = new JButton();
    btnDeleteProfile = new JButton();
    btnCreateNewProfile = new JButton();
    btnActivateProfile = new JButton();
    btnExportProfile = new JButton();
    btnCopyProfile = new JButton();
    spinnerTimeout = new JSpinner();
    jLabel1 = new JLabel();
    rdoStartWithActiveProfile = new JRadioButton();
    rdoStartWithProfileSelector = new JRadioButton();
    searchPathsPanel = new JPanel();
    btnRemoveSearchPath = new JButton();
    btnAddSearchPath = new JButton();
    jScrollPane3 = new JScrollPane();
    searchPathsTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    profilesPopupMenu.addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuWillBecomeVisible(PopupMenuEvent evt) {
            profilesPopupMenuPopupMenuWillBecomeVisible(evt);
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) {
        }

        public void popupMenuCanceled(PopupMenuEvent evt) {
        }
    });
    // NOI18N
    ResourceBundle bundle = ResourceBundle.getBundle("jmri/profile/Bundle");
    // NOI18N
    renameMI.setText(bundle.getString("ProfilePreferencesPanel.renameMI.text"));
    renameMI.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            renameMIActionPerformed(evt);
        }
    });
    profilesPopupMenu.add(renameMI);
    profilesPopupMenu.add(jSeparator1);
    // NOI18N
    copyMI.setText(bundle.getString("ProfilePreferencesPanel.copyMI.text"));
    profilesPopupMenu.add(copyMI);
    // NOI18N
    deleteMI.setText(bundle.getString("ProfilePreferencesPanel.deleteMI.text"));
    profilesPopupMenu.add(deleteMI);
    if (ProfileManager.getDefault().isAutoStartActiveProfile()) {
        this.rdoStartWithActiveProfile.setSelected(true);
    } else {
        this.rdoStartWithProfileSelector.setSelected(true);
    }
    profilesTbl.setModel(new ProfileTableModel());
    profilesTbl.getSelectionModel().addListSelectionListener(new ProfilesSelectionListener());
    profilesTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane1.setViewportView(profilesTbl);
    // NOI18N
    btnOpenExistingProfile.setText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.text"));
    // NOI18N
    btnOpenExistingProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.toolTipText"));
    btnOpenExistingProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnOpenExistingProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnDeleteProfile.setText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.text"));
    // NOI18N
    btnDeleteProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.toolTipText"));
    btnDeleteProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnDeleteProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCreateNewProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.text"));
    // NOI18N
    btnCreateNewProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
    btnCreateNewProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCreateNewProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnActivateProfile.setText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.text"));
    // NOI18N
    btnActivateProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.toolTipText"));
    btnActivateProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnActivateProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnExportProfile.setText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.text"));
    // NOI18N
    btnExportProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.toolTipText"));
    btnExportProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnExportProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCopyProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCopyProfile.text"));
    btnCopyProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCopyProfileActionPerformed(evt);
        }
    });
    spinnerTimeout.setModel(new SpinnerNumberModel(10, 0, 500, 1));
    spinnerTimeout.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent evt) {
            spinnerTimeoutStateChanged(evt);
        }
    });
    // NOI18N
    jLabel1.setText(bundle.getString("ProfilePreferencesPanel.jLabel1.text"));
    grpStartWithSelectors.add(rdoStartWithActiveProfile);
    // NOI18N
    rdoStartWithActiveProfile.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithActiveProfile.text"));
    rdoStartWithActiveProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithActiveProfileActionPerformed(evt);
        }
    });
    grpStartWithSelectors.add(rdoStartWithProfileSelector);
    // NOI18N
    rdoStartWithProfileSelector.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithProfileSelector.text"));
    rdoStartWithProfileSelector.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithProfileSelectorActionPerformed(evt);
        }
    });
    GroupLayout enabledPanelLayout = new GroupLayout(enabledPanel);
    enabledPanel.setLayout(enabledPanelLayout);
    enabledPanelLayout.setHorizontalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(btnActivateProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnOpenExistingProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreateNewProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCopyProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnExportProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE).addComponent(btnDeleteProfile)).addGroup(enabledPanelLayout.createSequentialGroup().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(rdoStartWithActiveProfile).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(rdoStartWithProfileSelector).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1))).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
    enabledPanelLayout.setVerticalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnOpenExistingProfile).addComponent(btnCreateNewProfile).addComponent(btnActivateProfile).addComponent(btnExportProfile).addComponent(btnDeleteProfile).addComponent(btnCopyProfile)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(rdoStartWithActiveProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(rdoStartWithProfileSelector).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1))));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"), enabledPanel);
    // NOI18N
    btnRemoveSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.text"));
    // NOI18N
    btnRemoveSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.toolTipText"));
    btnRemoveSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnRemoveSearchPathActionPerformed(evt);
        }
    });
    // NOI18N
    btnAddSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.text"));
    // NOI18N
    btnAddSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.toolTipText"));
    btnAddSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnAddSearchPathActionPerformed(evt);
        }
    });
    searchPathsTbl.setModel(new SearchPathTableModel());
    searchPathsTbl.getSelectionModel().addListSelectionListener(new SearchPathSelectionListener());
    searchPathsTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane3.setViewportView(searchPathsTbl);
    GroupLayout searchPathsPanelLayout = new GroupLayout(searchPathsPanel);
    searchPathsPanel.setLayout(searchPathsPanelLayout);
    searchPathsPanelLayout.setHorizontalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE).addGroup(searchPathsPanelLayout.createSequentialGroup().addComponent(btnAddSearchPath).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(btnRemoveSearchPath))).addContainerGap()));
    searchPathsPanelLayout.setVerticalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnAddSearchPath).addComponent(btnRemoveSearchPath)).addContainerGap()));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.searchPathsPanel.TabConstraints.tabTitle_1"), searchPathsPanel);
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1, GroupLayout.Alignment.TRAILING));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));
    // NOI18N
    jTabbedPane1.getAccessibleContext().setAccessibleName(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"));
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) PopupMenuListener(javax.swing.event.PopupMenuListener) JButton(javax.swing.JButton) PopupMenuEvent(javax.swing.event.PopupMenuEvent) SpinnerNumberModel(javax.swing.SpinnerNumberModel) GroupLayout(javax.swing.GroupLayout) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener) JMenuItem(javax.swing.JMenuItem) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JLabel(javax.swing.JLabel) JPopupMenu(javax.swing.JPopupMenu) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) ResourceBundle(java.util.ResourceBundle)

Example 94 with JTabbedPane

use of javax.swing.JTabbedPane in project jgnash by ccavanaugh.

the class SplitsDialog method initComponents.

private void initComponents() {
    newButton = new JButton(rb.getString("Button.New"));
    deleteButton = new JButton(rb.getString("Button.Delete"));
    deleteAllButton = new JButton(rb.getString("Button.DeleteAll"));
    okButton = new JButton(rb.getString("Button.Ok"));
    cancelButton = new JButton(rb.getString("Button.Cancel"));
    concatenateMemoCheckBox = new JCheckBox(rb.getString("Button.ConcatenateMemos"));
    concatenateMemoCheckBox.setSelected(RegisterFactory.getConcatenateMemos());
    okButton.addActionListener(this);
    cancelButton.addActionListener(this);
    newButton.addActionListener(this);
    deleteButton.addActionListener(this);
    deleteAllButton.addActionListener(this);
    tabbedPane = new JTabbedPane();
    debitPanel = new SplitTransactionEntryPanel(model, PanelType.DECREASE);
    creditPanel = new SplitTransactionEntryPanel(model, PanelType.INCREASE);
    String[] tabNames = RegisterFactory.getCreditDebitTabNames(account);
    tabbedPane.add(tabNames[0], creditPanel);
    tabbedPane.add(tabNames[1], debitPanel);
    table.getSelectionModel().addListSelectionListener(this);
    concatenateMemoCheckBox.addActionListener(e -> RegisterFactory.setConcatenateMemos(concatenateMemoCheckBox.isSelected()));
}
Also used : JCheckBox(javax.swing.JCheckBox) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton)

Example 95 with JTabbedPane

use of javax.swing.JTabbedPane in project jgnash by ccavanaugh.

the class RecurringEntryDialog method createFreqPanel.

private JPanel createFreqPanel() {
    FormLayout layout = new FormLayout("right:p, 4dlu, max(48dlu;min), 6dlu, p, f:p:g", "f:p, 3dlu, min");
    CellConstraints cc = new CellConstraints();
    JPanel p = new JPanel(layout);
    startDateField = new DatePanel();
    enabledCheckBox = new JCheckBox(rb.getString("Button.Enabled"));
    freqTab = new JTabbedPane();
    freqTab.add(rb.getString("Tab.None"), new NoneTab());
    freqTab.add(rb.getString("Tab.Day"), new DayTab());
    freqTab.add(rb.getString("Tab.Week"), new WeekTab());
    freqTab.add(rb.getString("Tab.Month"), new MonthTab());
    freqTab.add(rb.getString("Tab.Year"), new YearTab());
    tabMap.put(OneTimeReminder.class, 0);
    tabMap.put(DailyReminder.class, 1);
    tabMap.put(WeeklyReminder.class, 2);
    tabMap.put(MonthlyReminder.class, 3);
    tabMap.put(YearlyReminder.class, 4);
    p.add(new JLabel(rb.getString("Label.FirstPayDate")), cc.xy(1, 1));
    p.add(startDateField, cc.xy(3, 1));
    p.add(enabledCheckBox, cc.xy(5, 1));
    p.add(freqTab, cc.xywh(1, 3, 6, 1));
    return p;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) DatePanel(jgnash.ui.components.DatePanel) JTabbedPane(javax.swing.JTabbedPane) JLabel(javax.swing.JLabel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Aggregations

JTabbedPane (javax.swing.JTabbedPane)104 JPanel (javax.swing.JPanel)51 BorderLayout (java.awt.BorderLayout)33 JLabel (javax.swing.JLabel)26 JButton (javax.swing.JButton)25 JScrollPane (javax.swing.JScrollPane)23 Dimension (java.awt.Dimension)19 ActionEvent (java.awt.event.ActionEvent)18 ActionListener (java.awt.event.ActionListener)15 JCheckBox (javax.swing.JCheckBox)14 ChangeListener (javax.swing.event.ChangeListener)13 GridBagLayout (java.awt.GridBagLayout)12 BoxLayout (javax.swing.BoxLayout)12 ChangeEvent (javax.swing.event.ChangeEvent)12 GridBagConstraints (java.awt.GridBagConstraints)11 Insets (java.awt.Insets)11 ArrayList (java.util.ArrayList)10 JFrame (javax.swing.JFrame)10 JMenuItem (javax.swing.JMenuItem)10 JSplitPane (javax.swing.JSplitPane)10