Search in sources :

Example 36 with JSplitPane

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

the class RosterFrame method buildWindow.

protected final void buildWindow() {
    //Additions to the toolbar need to be added first otherwise when trying to hide bits up during the initialisation they remain on screen
    additionsToToolBar();
    frameInstances.add(this);
    prefsMgr = InstanceManager.getDefault(UserPreferencesManager.class);
    getTop().add(createTop());
    getBottom().setMinimumSize(summaryPaneDim);
    getBottom().add(createBottom());
    statusBar();
    systemsMenu();
    helpMenu(getMenu(), this);
    if ((!prefsMgr.getSimplePreferenceState(this.getClass().getName() + ".hideGroups")) && !Roster.getDefault().getRosterGroupList().isEmpty()) {
        hideGroupsPane(false);
    } else {
        hideGroupsPane(true);
    }
    if (prefsMgr.getSimplePreferenceState(this.getClass().getName() + ".hideSummary")) {
        //We have to set it to display first, then we can hide it.
        hideBottomPane(false);
        hideBottomPane(true);
    }
    PropertyChangeListener propertyChangeListener = (PropertyChangeEvent changeEvent) -> {
        JSplitPane sourceSplitPane = (JSplitPane) changeEvent.getSource();
        String propertyName = changeEvent.getPropertyName();
        if (propertyName.equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) {
            int current = sourceSplitPane.getDividerLocation() + sourceSplitPane.getDividerSize();
            int panesize = (int) (sourceSplitPane.getSize().getHeight());
            hideBottomPane = panesize - current <= 1;
        //p.setSimplePreferenceState(DecoderPro3Window.class.getName()+".hideSummary",hideSummary);
        }
    };
    updateProgrammerStatus();
    ConnectionStatus.instance().addPropertyChangeListener((PropertyChangeEvent e) -> {
        if ((e.getPropertyName().equals("change")) || (e.getPropertyName().equals("add"))) {
            log.debug("Received property {} with value {} ", e.getPropertyName(), e.getNewValue());
            updateProgrammerStatus();
        }
    });
    InstanceManager.addPropertyChangeListener((PropertyChangeEvent e) -> {
        if (e.getPropertyName().equals(InstanceManager.getDefaultsPropertyName(ProgrammerManager.class))) {
            log.debug("Received property {} with value {} ", e.getPropertyName(), e.getNewValue());
            updateProgrammerStatus();
        }
    });
    getSplitPane().addPropertyChangeListener(propertyChangeListener);
    if (this.getProgrammerConfigManager().getDefaultFile() != null) {
        programmer1 = this.getProgrammerConfigManager().getDefaultFile();
    }
    this.getProgrammerConfigManager().addPropertyChangeListener(ProgrammerConfigManager.DEFAULT_FILE, (PropertyChangeEvent evt) -> {
        if (this.getProgrammerConfigManager().getDefaultFile() != null) {
            programmer1 = this.getProgrammerConfigManager().getDefaultFile();
        }
    });
    String lastProg = (String) prefsMgr.getProperty(getWindowFrameRef(), "selectedProgrammer");
    if (lastProg != null) {
        if (lastProg.equals("service") && service.isEnabled()) {
            service.setSelected(true);
            updateProgMode();
        } else if (lastProg.equals("ops") && ops.isEnabled()) {
            ops.setSelected(true);
            updateProgMode();
        } else if (lastProg.equals("edit") && edit.isEnabled()) {
            edit.setSelected(true);
            updateProgMode();
        }
    }
    if (frameInstances.size() > 1) {
        firePropertyChange("closewindow", "setEnabled", true);
        allowQuit(frameInstances.get(0).isAllowQuit());
    } else {
        firePropertyChange("closewindow", "setEnabled", false);
    }
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) ProgrammerManager(jmri.ProgrammerManager) GlobalProgrammerManager(jmri.GlobalProgrammerManager) AddressedProgrammerManager(jmri.AddressedProgrammerManager) JSplitPane(javax.swing.JSplitPane) UserPreferencesManager(jmri.UserPreferencesManager)

Example 37 with JSplitPane

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

the class TimeLogEditor method constructUserInterface.

/*
     * methods for constructing the user interface
     */
private void constructUserInterface() {
    loadCustomDimensions();
    frame = new JFrame(getResource("Time_Log_Editor_Window_Title"));
    DashboardIconFactory.setWindowIcon(frame);
    frame.setSize(new Dimension(frameWidth, frameHeight));
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            confirmClose(true);
        }
    });
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    PCSH.enableHelpKey(frame, "UsingTimeLogEditor");
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, constructTreePanel(), constructEditPanel());
    splitPane.setDividerLocation(dividerLocation);
    // Setup drag-and-drop support on Java 6 and above
    new FallbackObjectFactory<TimeLogEditorDragDropSetup>(TimeLogEditorDragDropSetup.class).add(//
    "TimeLogEditorDragDropSetupJava6").get(true).setupEditorForDragDrop(this);
    Container panel = frame.getContentPane();
    panel.setLayout(new BorderLayout());
    panel.add(BorderLayout.NORTH, constructFilterPanel());
    panel.add(BorderLayout.CENTER, splitPane);
    panel.add(BorderLayout.SOUTH, constructControlPanel());
    createRecalcTimer();
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 38 with JSplitPane

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

the class PreferencesDialog method reload.

private void reload() {
    List panesDefinitions = ExtensionManager.getXmlConfigurationElements(PREFERENCES_PANE_TAG_NAME);
    List<PreferencesPane> panes = getPreferencesPanes(panesDefinitions);
    Vector<PreferencesCategory> categories = getPreferencesGategories(panes);
    Container pane = this.getContentPane();
    pane.removeAll();
    pane.setLayout(new BorderLayout());
    pane.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getCategoryChooser(categories), preferencesPanels), BorderLayout.CENTER);
    pane.add(getBottomSection(), BorderLayout.PAGE_END);
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) ArrayList(java.util.ArrayList) JList(javax.swing.JList) List(java.util.List) JSplitPane(javax.swing.JSplitPane)

Example 39 with JSplitPane

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

the class HierarchyNoteEditorDialog method constructUserInterface.

private void constructUserInterface() {
    loadCustomDimensions();
    frame = new JFrame(resources.getString("Window_Title"));
    DashboardIconFactory.setWindowIcon(frame);
    frame.setSize(new Dimension(frameWidth, frameHeight));
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            confirmClose(true);
        }
    });
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    PCSH.enableHelpKey(frame, "NoteIndicator");
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, constructTreePanel(), constructEditPanel());
    splitPane.setDividerLocation(dividerLocation);
    setupWindowKeyBindings(splitPane);
    Container panel = frame.getContentPane();
    panel.setLayout(new BorderLayout());
    panel.add(BorderLayout.CENTER, splitPane);
}
Also used : Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 40 with JSplitPane

use of javax.swing.JSplitPane in project aerospike-client-java by aerospike.

the class GuiDisplay method initialize.

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frmAerospikeExamples = new JFrame();
    frmAerospikeExamples.setTitle("Aerospike Java Client Examples");
    frmAerospikeExamples.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmAerospikeExamples.pack();
    frmAerospikeExamples.getContentPane().setLayout(new BorderLayout(0, 0));
    splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    frmAerospikeExamples.getContentPane().add(splitPane, BorderLayout.CENTER);
    mainPanel = new JPanel();
    splitPane.setLeftComponent(mainPanel);
    mainPanel.setLayout(new BorderLayout(0, 0));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    runButton = new JButton("Run");
    runButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent ev) {
            consoleTextArea.setText("");
            run_selected_examples();
        }
    });
    buttonPanel.add(runButton);
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    exitButton = new JButton("Quit");
    exitButton.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            Container Frame = exitButton.getParent();
            do {
                Frame = Frame.getParent();
            } while (!(Frame instanceof JFrame));
            ((JFrame) Frame).dispose();
        }
    });
    buttonPanel.add(exitButton);
    sourceTextPane = new JTextArea();
    sourceTextPane.setTabSize(2);
    sourceTextPane.setEditable(false);
    scrollPane = new JScrollPane(sourceTextPane);
    scrollPane.setViewportBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    scrollPane.setPreferredSize(new Dimension(600, 100));
    mainPanel.add(scrollPane, BorderLayout.CENTER);
    connectionPanel = new JPanel();
    connectionPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    lblServerHost = new JLabel("Server Host");
    connectionPanel.add(lblServerHost);
    seedHostTextField = new JTextField();
    seedHostTextField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            params.host = seedHostTextField.getText();
        }
    });
    connectionPanel.add(seedHostTextField);
    seedHostTextField.setColumns(10);
    lblPort = new JLabel("Port");
    connectionPanel.add(lblPort);
    portTextField = new JTextField();
    portTextField.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent arg0) {
            String newValue = namespaceTextField.getText();
            if (newValue != null && newValue != "") {
                try {
                    params.port = Integer.parseInt(newValue);
                } catch (NumberFormatException ne) {
                // ne.printStackTrace();
                }
            }
        }
    });
    connectionPanel.add(portTextField);
    portTextField.setColumns(4);
    lblusername = new JLabel("User");
    connectionPanel.add(lblusername);
    usernameTextField = new JTextField();
    usernameTextField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            params.user = usernameTextField.getText();
        }
    });
    connectionPanel.add(usernameTextField);
    usernameTextField.setColumns(8);
    lblpassword = new JLabel("Password");
    connectionPanel.add(lblpassword);
    passwordTextField = new JPasswordField();
    passwordTextField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            params.user = new String(passwordTextField.getPassword());
        }
    });
    connectionPanel.add(passwordTextField);
    passwordTextField.setColumns(8);
    lblnameSpace = new JLabel("Namespace");
    connectionPanel.add(lblnameSpace);
    namespaceTextField = new JTextField();
    namespaceTextField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            params.namespace = namespaceTextField.getText();
        }
    });
    connectionPanel.add(namespaceTextField);
    namespaceTextField.setColumns(8);
    lblSet = new JLabel("Set");
    connectionPanel.add(lblSet);
    txtSetTextfield = new JTextField();
    txtSetTextfield.addKeyListener(new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            params.set = txtSetTextfield.getText();
        }
    });
    connectionPanel.add(txtSetTextfield);
    txtSetTextfield.setColumns(8);
    mainPanel.add(connectionPanel, BorderLayout.NORTH);
    examplePanel = new JPanel();
    examplePanel.setLayout(new BoxLayout(examplePanel, BoxLayout.Y_AXIS));
    exampleScrollPane = new JScrollPane(examplePanel);
    mainPanel.add(exampleScrollPane, BorderLayout.WEST);
    // init values
    seedHostTextField.setText(params.host);
    portTextField.setText(Integer.toString(params.port));
    namespaceTextField.setText(params.namespace);
    txtSetTextfield.setText(params.set);
    // int width = 785;
    int width = 1000;
    int height = 180;
    consoleTextArea = new JTextArea();
    consoleTextArea.setSize(new Dimension(width, height));
    consoleTextArea.setEditable(false);
    consoleScrollPane = new JScrollPane(consoleTextArea);
    consoleScrollPane.setPreferredSize(new Dimension(width, height));
    consoleScrollPane.setSize(new Dimension(width, height));
    splitPane.setRightComponent(consoleScrollPane);
    buttonGroup = new ButtonGroup();
    JRadioButton jrb;
    for (String example : Main.getAllExampleNames()) {
        jrb = new JRadioButton(example);
        jrb.setActionCommand(example);
        jrb.addActionListener(this);
        buttonGroup.add(jrb);
        examplePanel.add(jrb);
    }
    frmAerospikeExamples.pack();
}
Also used : JPanel(javax.swing.JPanel) FocusAdapter(java.awt.event.FocusAdapter) FlowLayout(java.awt.FlowLayout) JTextArea(javax.swing.JTextArea) JRadioButton(javax.swing.JRadioButton) KeyAdapter(java.awt.event.KeyAdapter) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JTextField(javax.swing.JTextField) FocusEvent(java.awt.event.FocusEvent) KeyEvent(java.awt.event.KeyEvent) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) EtchedBorder(javax.swing.border.EtchedBorder) JPasswordField(javax.swing.JPasswordField) ButtonGroup(javax.swing.ButtonGroup) JSplitPane(javax.swing.JSplitPane)

Aggregations

JSplitPane (javax.swing.JSplitPane)109 BorderLayout (java.awt.BorderLayout)69 JPanel (javax.swing.JPanel)64 JScrollPane (javax.swing.JScrollPane)54 Dimension (java.awt.Dimension)40 JLabel (javax.swing.JLabel)31 JButton (javax.swing.JButton)17 JTextArea (javax.swing.JTextArea)16 FlowLayout (java.awt.FlowLayout)15 Insets (java.awt.Insets)15 GridBagLayout (java.awt.GridBagLayout)14 GridBagConstraints (java.awt.GridBagConstraints)13 JTable (javax.swing.JTable)13 Container (java.awt.Container)10 GridLayout (java.awt.GridLayout)10 ArrayList (java.util.ArrayList)10 BoxLayout (javax.swing.BoxLayout)10 JComponent (javax.swing.JComponent)10 JTabbedPane (javax.swing.JTabbedPane)10 EmptyBorder (javax.swing.border.EmptyBorder)10