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);
}
}
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();
}
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);
}
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);
}
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();
}
Aggregations