use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.
the class MetalworksFrame method openHelpWindow.
public void openHelpWindow() {
JInternalFrame help = new MetalworksHelp();
desktop.add(help, HELPLAYER);
try {
help.setVisible(true);
help.setSelected(true);
} catch (java.beans.PropertyVetoException e2) {
}
}
use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.
the class Test6325652 method create.
private static JInternalFrame create(int index) {
// NON-NLS: frame identification
String text = "test" + index;
index = index * 3 + 1;
JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
internal.getContentPane().add(new JTextArea(text));
internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
internal.setVisible(true);
return internal;
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class TableFrames method makePathTurnoutFrame.
/*
* ********************* PathTurnoutFrame *****************************
*/
protected JInternalFrame makePathTurnoutFrame(OBlock block, String pathName) {
String title = Bundle.getMessage("TitlePathTurnoutTable", block.getDisplayName(), pathName);
JInternalFrame frame = new JInternalFrame(title, true, true, false, true);
if (log.isDebugEnabled()) {
log.debug("makePathTurnoutFrame for Block " + block.getDisplayName() + " and Path " + pathName);
}
frame.setName(makePathTurnoutName(block.getSystemName(), pathName));
OPath path = block.getPathByName(pathName);
if (path == null) {
return null;
}
PathTurnoutTableModel PathTurnoutModel = new PathTurnoutTableModel(path);
PathTurnoutModel.init();
JTable PathTurnoutTable = new JTable(PathTurnoutModel);
PathTurnoutTable.setTransferHandler(new jmri.util.DnDTableImportExportHandler(new int[] { PathTurnoutTableModel.SETTINGCOLUMN, PathTurnoutTableModel.DELETE_COL }));
PathTurnoutTable.setDragEnabled(true);
JComboBox<String> box = new JComboBox<String>(PathTurnoutTableModel.turnoutStates);
PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.SETTINGCOLUMN).setCellEditor(new DefaultCellEditor(box));
PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.DELETE_COL).setCellEditor(new ButtonEditor(new JButton()));
PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.DELETE_COL).setCellRenderer(new ButtonRenderer());
//PathTurnoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
for (int i = 0; i < PathTurnoutModel.getColumnCount(); i++) {
int width = PathTurnoutModel.getPreferredWidth(i);
PathTurnoutTable.getColumnModel().getColumn(i).setPreferredWidth(width);
}
PathTurnoutTable.sizeColumnsToFit(-1);
int tableWidth = PathTurnoutTable.getPreferredSize().width;
PathTurnoutTable.setPreferredScrollableViewportSize(new java.awt.Dimension(tableWidth, ROW_HEIGHT * 5));
JScrollPane tablePane = new JScrollPane(PathTurnoutTable);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout(5, 5));
JLabel prompt = new JLabel(Bundle.getMessage("AddTurnoutPrompt"));
contentPane.add(prompt, BorderLayout.NORTH);
contentPane.add(tablePane, BorderLayout.CENTER);
frame.addInternalFrameListener(this);
frame.setContentPane(contentPane);
frame.setLocation(10, 270);
frame.pack();
return frame;
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class TableFrames method openPathTurnoutFrame.
protected void openPathTurnoutFrame(String pathTurnoutName) {
JInternalFrame frame = _PathTurnoutMap.get(pathTurnoutName);
log.debug("openPathTurnoutFrame for " + pathTurnoutName);
if (frame == null) {
int index = pathTurnoutName.indexOf('&');
String pathName = pathTurnoutName.substring(1, index);
String sysName = pathTurnoutName.substring(index + 1);
OBlock block = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).getBySystemName(sysName);
if (block == null) {
return;
}
frame = makePathTurnoutFrame(block, pathName);
if (frame == null) {
return;
}
_PathTurnoutMap.put(pathTurnoutName, frame);
frame.setVisible(true);
_desktop.add(frame);
frame.moveToFront();
} else {
frame.setVisible(true);
try {
frame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("PathTurnout Table Frame for \"" + pathTurnoutName + "\" vetoed setIcon " + pve.toString());
}
frame.moveToFront();
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class TableFrames method internalFrameClosed.
@Override
public void internalFrameClosed(InternalFrameEvent e) {
JInternalFrame frame = (JInternalFrame) e.getSource();
String name = frame.getName();
if (log.isDebugEnabled()) {
log.debug("Internal frame closed: " + frame.getTitle() + ", name= " + name + " size (" + frame.getSize().getWidth() + ", " + frame.getSize().getHeight() + ")");
}
if (name != null && name.startsWith("OB")) {
_blockPathMap.remove(name);
WarrantTableAction.initPathPortalCheck();
WarrantTableAction.checkPathPortals(((BlockPathFrame) frame).getModel().getBlock());
((BlockPathFrame) frame).getModel().removeListener();
if (_showWarnings) {
WarrantTableAction.showPathPortalErrors();
}
} else {
_PathTurnoutMap.remove(name);
}
}
Aggregations