Search in sources :

Example 46 with JTabbedPane

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

the class ControllerFilterFrame method initComponents.

@Override
public void initComponents() throws Exception {
    JTabbedPane tabbedPane = new JTabbedPane();
    if (InstanceManager.getNullableDefault(jmri.TurnoutManager.class) != null) {
        tabbedPane.addTab(rb.getString("LabelTurnout"), null, addTurnoutPanel(), rb.getString("ToolTipTurnoutTab"));
    }
    if (InstanceManager.getNullableDefault(jmri.RouteManager.class) != null) {
        tabbedPane.addTab(rb.getString("LabelRoute"), null, addRoutePanel(), rb.getString("ToolTipRouteTab"));
    }
    add(tabbedPane);
    pack();
    addHelpMenu("package.jmri.jmrit.withrottle.UserInterface", true);
}
Also used : JTabbedPane(javax.swing.JTabbedPane) TurnoutManager(jmri.TurnoutManager) RouteManager(jmri.RouteManager)

Example 47 with JTabbedPane

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

the class EcosLocoTableTabAction method createModel.

@Override
protected void createModel() {
    dataPanel = new JPanel();
    dataTabs = new JTabbedPane();
    dataPanel.setLayout(new BorderLayout());
    java.util.List<EcosSystemConnectionMemo> list = jmri.InstanceManager.getList(EcosSystemConnectionMemo.class);
    if (list != null) {
        for (EcosSystemConnectionMemo eMemo : list) {
            //We only want to add connections that have an active loco address manager
            if (eMemo.getLocoAddressManager() != null) {
                TabbedTableItem itemModel = new TabbedTableItem(eMemo.getUserName(), true, eMemo.getLocoAddressManager(), getNewTableAction(eMemo.getUserName(), eMemo));
                tabbedTableArray.add(itemModel);
            }
        }
    }
    if (tabbedTableArray.size() == 1) {
        EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(0).getAAClass();
        table.addToPanel(this);
        dataPanel.add(tabbedTableArray.get(0).getPanel(), BorderLayout.CENTER);
    } else {
        for (int x = 0; x < tabbedTableArray.size(); x++) {
            EcosLocoTableAction table = (EcosLocoTableAction) tabbedTableArray.get(x).getAAClass();
            table.addToPanel(this);
            dataTabs.addTab(tabbedTableArray.get(x).getItemString(), null, tabbedTableArray.get(x).getPanel(), null);
        }
        dataTabs.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent evt) {
                setMenuBar(f);
            }
        });
        dataPanel.add(dataTabs, BorderLayout.CENTER);
    }
    init = true;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) EcosSystemConnectionMemo(jmri.jmrix.ecos.EcosSystemConnectionMemo) JTabbedPane(javax.swing.JTabbedPane) ChangeListener(javax.swing.event.ChangeListener)

Example 48 with JTabbedPane

use of javax.swing.JTabbedPane in project processdash by dtuma.

the class LOCDiffDialog method createTabPanel.

private Component createTabPanel(List<Panel> panels) {
    tabPane = new JTabbedPane();
    String prefTab = PREFS.get(SELECTED_TAB_PREF, "");
    for (Panel p : panels) {
        JPanel wrap = new JPanel(new BorderLayout());
        wrap.add(p.getConfigPanel());
        wrap.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5));
        tabPane.addTab(p.getShortName(), wrap);
        if (p.getId().equals(prefTab))
            tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
    }
    return tabPane;
}
Also used : JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane)

Example 49 with JTabbedPane

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

the class ItemPalette method buildTabPane.

/**
     * Add the tabs on the the Control Panel Editor
     */
static void buildTabPane(ItemPalette palette, Editor editor) {
    _tabPane = new JTabbedPane();
    _tabIndex = new HashMap<String, ItemPanel>();
    ItemPanel itemPanel = new TableItemPanel(palette, "Turnout", null, PickListModel.turnoutPickModelInstance(), editor);
    // show panel on start
    itemPanel.init();
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameTurnout"));
    _tabIndex.put("Turnout", itemPanel);
    itemPanel = new TableItemPanel(palette, "Sensor", null, PickListModel.sensorPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameSensor"));
    _tabIndex.put("Sensor", itemPanel);
    itemPanel = new SignalHeadItemPanel(palette, "SignalHead", null, PickListModel.signalHeadPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameSignalHead"));
    _tabIndex.put("SignalHead", itemPanel);
    itemPanel = new SignalMastItemPanel(palette, "SignalMast", null, PickListModel.signalMastPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameSignalMast"));
    _tabIndex.put("SignalMast", itemPanel);
    itemPanel = new MemoryItemPanel(palette, "Memory", null, PickListModel.memoryPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameMemory"));
    _tabIndex.put("Memory", itemPanel);
    itemPanel = new ReporterItemPanel(palette, "Reporter", null, PickListModel.reporterPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameReporter"));
    _tabIndex.put("Reporter", itemPanel);
    itemPanel = new TableItemPanel(palette, "Light", null, PickListModel.lightPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNameLight"));
    _tabIndex.put("Light", itemPanel);
    itemPanel = new MultiSensorItemPanel(palette, "MultiSensor", null, PickListModel.multiSensorPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("MultiSensor"));
    _tabIndex.put("MultiSensor", itemPanel);
    ItemPanel iconPanel = new IconItemPanel(palette, "Icon", editor);
    _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("Icon"));
    // changed from "itemPanel"
    _tabIndex.put("Icon", iconPanel);
    iconPanel = new BackgroundItemPanel(palette, "Background", editor);
    _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("Background"));
    _tabIndex.put("Background", iconPanel);
    iconPanel = new TextItemPanel(palette, "Text", editor);
    _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("Text"));
    _tabIndex.put("Text", iconPanel);
    iconPanel = new RPSItemPanel(palette, "RPSReporter", null, editor);
    //        itemPanel.init();  // show panel on start
    _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("RPSReporter"));
    _tabIndex.put("RPSReporter", iconPanel);
    iconPanel = new ClockItemPanel(palette, "FastClock", editor);
    _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("FastClock"));
    _tabIndex.put("FastClock", iconPanel);
    itemPanel = new IndicatorItemPanel(palette, "IndicatorTrack", null, editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("IndicatorTrack"));
    _tabIndex.put("IndicatorTrack", itemPanel);
    itemPanel = new IndicatorTOItemPanel(palette, "IndicatorTO", null, PickListModel.turnoutPickModelInstance(), editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("IndicatorTO"));
    _tabIndex.put("IndicatorTO", itemPanel);
    itemPanel = new PortalItemPanel(palette, "Portal", null, editor);
    _tabPane.add(new JScrollPane(itemPanel), Bundle.getMessage("BeanNamePortal"));
    _tabIndex.put("Portal", itemPanel);
    _tabPane.addChangeListener(palette);
//        _tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);     
}
Also used : JScrollPane(javax.swing.JScrollPane) JTabbedPane(javax.swing.JTabbedPane)

Example 50 with JTabbedPane

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

the class VSDecoderPane method initComponents.

/**
     * initComponents()
     *
     * initialzies the GUI components.
     */
@Override
public void initComponents() {
    log.debug("initComponents()");
    //buildMenu();
    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    // Add the tabbed pane to the VSDecoderPane.  The tabbedPane will contain all the other panes.
    tabbedPane = new JTabbedPane();
    GridBagConstraints gbc1 = new GridBagConstraints();
    gbc1.gridx = 0;
    gbc1.gridy = 0;
    gbc1.fill = GridBagConstraints.BOTH;
    gbc1.anchor = GridBagConstraints.CENTER;
    gbc1.weightx = 1.0;
    gbc1.weighty = 1.0;
    this.add(tabbedPane, gbc1);
    //-------------------------------------------------------------------
    // configPanel
    // The configPanel holds the stuff for addressing and configuration.
    configPanel = new VSDConfigPanel(decoder_id, this);
    tabbedPane.addTab("Config", configPanel);
    //-------------------------------------------------------------------
    // soundsPanel
    // The optionPanel holds controls for selecting sound options.
    optionPanel = new VSDOptionPanel(decoder_id, this);
    tabbedPane.addTab("Options", optionPanel);
    //-------------------------------------------------------------------
    // soundsPanel
    // The soundsPanel holds buttons for specific sounds.
    soundsPanel = new VSDSoundsPanel(decoder_id, this);
    tabbedPane.addTab("Sounds", soundsPanel);
    //-------------------------------------------------------------------
    // volumePanel
    // The volumePanel holds the master volume and mute controls.
    volumePanel = new JPanel();
    volumePanel.setLayout(new BorderLayout(10, 0));
    TitledBorder title = BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), "Volume");
    title.setTitlePosition(TitledBorder.DEFAULT_POSITION);
    volumePanel.setBorder(title);
    JSlider volume = new JSlider(0, 100);
    volume.setMinorTickSpacing(10);
    volume.setPaintTicks(true);
    volume.setValue(80);
    volume.setPreferredSize(new Dimension(200, 20));
    volume.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            volumeChange(e);
        }
    });
    volumePanel.add(volume, BorderLayout.LINE_START);
    JToggleButton mute_button = new JToggleButton("Mute");
    mute_button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            muteButtonPressed(e);
        }
    });
    volumePanel.add(mute_button, BorderLayout.LINE_END);
    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.gridx = 0;
    gbc2.gridy = 1;
    gbc2.fill = GridBagConstraints.BOTH;
    gbc2.anchor = GridBagConstraints.CENTER;
    gbc2.weightx = 1.0;
    gbc2.weighty = 0.1;
    this.add(volumePanel, gbc2);
    //-------------------------------------------------------------------
    // statusBar
    // The statusBar shows decoder status.
    statusBar = new jmri.util.swing.StatusBar();
    statusBar.setMessage("Status: No decoder assigned");
    GridBagConstraints gbc3 = new GridBagConstraints();
    gbc3.gridx = 0;
    gbc3.gridy = 2;
    gbc3.fill = GridBagConstraints.BOTH;
    gbc3.anchor = GridBagConstraints.PAGE_END;
    gbc3.weightx = 1.0;
    gbc3.weighty = 0.1;
    this.add(statusBar, gbc3);
    //-------------------------------------------------------------------
    // Pack and set visible
    parent.pack();
    parent.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) BorderLayout(java.awt.BorderLayout) PropertyChangeEvent(java.beans.PropertyChangeEvent) ChangeEvent(javax.swing.event.ChangeEvent) JToggleButton(javax.swing.JToggleButton) ActionListener(java.awt.event.ActionListener) JSlider(javax.swing.JSlider) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener)

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