use of java.awt.Container in project jdk8u_jdk by JetBrains.
the class LaunchTool method configureAndConnect.
private void configureAndConnect(final Connector connector) {
final JDialog dialog = new JDialog();
final Map<String, Connector.Argument> args = connector.defaultArguments();
dialog.setModal(true);
dialog.setTitle("Connector Arguments");
Container content = dialog.getContentPane();
JPanel guts = new JPanel();
Border etched = BorderFactory.createEtchedBorder();
BorderFactory.createTitledBorder(etched, connector.description(), TitledBorder.LEFT, TitledBorder.TOP);
guts.setBorder(etched);
guts.setLayout(new BoxLayout(guts, BoxLayout.Y_AXIS));
// guts.add(new JLabel(connector.description()));
final List<ArgRep> argReps = new ArrayList<ArgRep>(args.size());
for (Connector.Argument arg : args.values()) {
ArgRep ar;
if (arg instanceof Connector.BooleanArgument) {
ar = new BooleanArgRep((Connector.BooleanArgument) arg, guts);
} else {
ar = new StringArgRep(arg, guts);
}
argReps.add(ar);
}
content.add(guts);
JPanel buttonPanel = okCancel(dialog, new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
for (ArgRep ar : argReps) {
if (!ar.isSpecified()) {
JOptionPane.showMessageDialog(dialog, ar.arg.label() + ": Argument must be specified", "No argument", JOptionPane.ERROR_MESSAGE);
return;
}
if (!ar.isValid()) {
JOptionPane.showMessageDialog(dialog, ar.arg.label() + ": Bad argument value: " + ar.getText(), "Bad argument", JOptionPane.ERROR_MESSAGE);
return;
}
ar.install();
}
try {
if (runtime.explictStart(connector, args)) {
dialog.setVisible(false);
dialog.dispose();
} else {
JOptionPane.showMessageDialog(dialog, "Bad arguments values: See diagnostics window.", "Bad arguments", JOptionPane.ERROR_MESSAGE);
}
} catch (VMLaunchFailureException exc) {
JOptionPane.showMessageDialog(dialog, "Launch Failure: " + exc, "Launch Failed", JOptionPane.ERROR_MESSAGE);
}
}
});
content.add(BorderLayout.SOUTH, buttonPanel);
dialog.pack();
dialog.setVisible(true);
}
use of java.awt.Container in project JMRI by JMRI.
the class ThrottleFrame method ynstrument.
// #JYNSTRUMENT# here instantiate the Jynstrument, put it in a component, initialize the context and start it
public JInternalFrame ynstrument(String path) {
if (path == null) {
return null;
}
// everything is there
Jynstrument it = JynstrumentFactory.createInstrument(path, this);
if (it == null) {
log.error("Error while creating Jynstrument " + path);
return null;
}
setTransparentBackground(it);
JInternalFrame newiFrame = new JInternalFrame(it.getClassName());
newiFrame.add(it);
newiFrame.addInternalFrameListener(frameListener);
newiFrame.setDoubleBuffered(true);
newiFrame.setResizable(true);
newiFrame.setClosable(true);
newiFrame.setIconifiable(true);
newiFrame.getContentPane().addContainerListener(new ContainerListener() {
@Override
public void componentAdded(ContainerEvent e) {
}
@Override
public void componentRemoved(ContainerEvent e) {
Container c = e.getContainer();
while ((!(c instanceof JInternalFrame)) && (!(c instanceof TranslucentJPanel))) {
c = c.getParent();
}
c.setVisible(false);
remove(c);
repaint();
}
});
newiFrame.pack();
add(newiFrame, PANEL_LAYER_FRAME);
newiFrame.setVisible(true);
return newiFrame;
}
use of java.awt.Container 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 java.awt.Container 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 java.awt.Container in project cytoscape-api by cytoscape.
the class WebServiceGUIClientTest method testGetQueryBuilderGUI.
@Override
public void testGetQueryBuilderGUI() {
WebServiceGUIClient client = new DummyGUIClient("test.xml", "dummy", "dummyClinet");
final Container clientGUI = client.getQueryBuilderGUI();
assertNotNull(clientGUI);
assertEquals(JPanel.class, clientGUI.getClass());
}
Aggregations