本文整理匯總了Java中javax.swing.JInternalFrame類的典型用法代碼示例。如果您正苦於以下問題:Java JInternalFrame類的具體用法?Java JInternalFrame怎麽用?Java JInternalFrame使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JInternalFrame類屬於javax.swing包,在下文中一共展示了JInternalFrame類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createInstanceImpl
import javax.swing.JInternalFrame; //導入依賴的package包/類
protected JInternalFrame createInstanceImpl() {
JInternalFrame frame = new JInternalFrame(title, resizable, closable, maximizable, iconable) {
protected JRootPane createRootPane() {
return _rootPane == null ? null : _rootPane.createInstance();
}
public void addNotify() {
try {
// Doesn't seem to work correctly
setClosed(_isClosed);
setMaximum(_isMaximum);
setIcon(_isIcon);
setSelected(_isSelected);
} catch (PropertyVetoException ex) {}
}
};
return frame;
}
示例2: getDump
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Returns information about component.
*/
@Override
public Hashtable<String, Object> getDump() {
Hashtable<String, Object> result = super.getDump();
result.put(TITLE_DPROP, ((JInternalFrame) getSource()).getTitle());
String state = STATE_NORMAL_DPROP_VALUE;
if (((JInternalFrame) getSource()).isClosed()) {
state = STATE_CLOSED_DPROP_VALUE;
} else if (((JInternalFrame) getSource()).isIcon()) {
state = STATE_ICONIFIED_DPROP_VALUE;
} else if (((JInternalFrame) getSource()).isMaximum()) {
state = STATE_MAXIMAZED_DPROP_VALUE;
}
result.put(STATE_DPROP, state);
result.put(IS_RESIZABLE_DPROP, ((JInternalFrame) getSource()).isResizable() ? "true" : "false");
result.put(IS_SELECTED_DPROP, ((JInternalFrame) getSource()).isSelected() ? "true" : "false");
return result;
}
示例3: setDataModelNotification
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Sets the data model update.
* @param dataModelNotification the new data model update
*/
public void setDataModelNotification(final DataModelNotification dataModelNotification) {
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
Vector<String> internalFramesTitles = new Vector<String>(getHashMapEditorFrames().keySet());
for (String internalFrameTitles : internalFramesTitles) {
JInternalFrame internalFrame = getHashMapEditorFrames().get(internalFrameTitles);
if (internalFrame instanceof BasicGraphGuiProperties) {
// --- Put notification into the property dialog ----
BasicGraphGuiProperties basicProperties = (BasicGraphGuiProperties) internalFrame;
if (basicProperties.setDataModelNotification(dataModelNotification)==true) return; // --- Done ! ---
}
}
// }
// });
}
示例4: removeFromCanvas
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Removes the given component from this canvas.
*
* @param comp The {@code Component} to remove.
*/
public void removeFromCanvas(Component comp) {
if (comp == null) return;
final Rectangle updateBounds = comp.getBounds();
final JInternalFrame frame = getInternalFrame(comp);
notifyClose(comp, frame);
if (frame != null && frame != comp) {
frame.dispose();
} else {
// Java 1.7.0 as seen on Fedora with:
// Java version: 1.7.0_40
// Java WM version: 24.0-b56
// crashes here deep in the java libraries.
try {
super.remove(comp);
} catch (Exception e) {
logger.log(Level.WARNING, "Java crash", e);
}
}
repaint(updateBounds.x, updateBounds.y,
updateBounds.width, updateBounds.height);
}
示例5: closePanel
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Close a panel by class name.
*
* @param panel The panel to close.
*/
public void closePanel(String panel) {
if (panel.endsWith("Panel")) {
for (Component c1 : getComponents()) {
if (c1 instanceof JInternalFrame) {
for (Component c2 : ((JInternalFrame)c1).getContentPane()
.getComponents()) {
if (panel.equals(c2.getClass().getName())) {
notifyClose(c2, (JInternalFrame)c1);
return;
}
}
}
}
} else if (panel.endsWith("Dialog")) {
for (FreeColDialog<?> fcd : dialogs) {
if (panel.equals(fcd.getClass().getName())) {
dialogs.remove(fcd);
fcd.dispose();
return;
}
}
}
}
示例6: isProbablyAContainer
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Return true if the given component is likely to be a container such the each
* component within the container should be be considered as a user input.
*
* @param c
* @return true if the component children should have this listener added.
*/
protected boolean isProbablyAContainer (Component c) {
boolean result = extListener != null ? extListener.isContainer(c) : false;
if (!result) {
boolean isSwing = isSwingClass(c);
if (isSwing) {
result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
c instanceof JFrame || c instanceof JRootPane || c instanceof
Window || c instanceof Frame || c instanceof Dialog ||
c instanceof JTabbedPane || c instanceof JInternalFrame ||
c instanceof JDesktopPane || c instanceof JLayeredPane;
} else {
result = c instanceof Container;
}
}
return result;
}
示例7: getExistingFreeColPanel
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Gets a currently displayed FreeColPanel of a given type.
*
* @param <T> The actual panel type.
* @param type The type of {@code FreeColPanel} to look for.
* @return A currently displayed {@code FreeColPanel} of the
* requested type, or null if none found.
*/
private <T extends FreeColPanel> T getExistingFreeColPanel(Class<T> type) {
for (Component c1 : getComponents()) {
if (c1 instanceof JInternalFrame) {
for (Component c2 : ((JInternalFrame)c1).getContentPane()
.getComponents()) {
try {
T ret = type.cast(c2);
if (ret != null) {
final JInternalFrame jif = (JInternalFrame)c1;
SwingUtilities.invokeLater(() -> {
jif.toFront();
jif.repaint();
});
return ret;
}
} catch (ClassCastException cce) {}
}
}
}
return null;
}
示例8: createUI
import javax.swing.JInternalFrame; //導入依賴的package包/類
private static void createUI() {
frame = new JFrame();
frame.setUndecorated(true);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
final JDesktopPane pane = new JDesktopPane();
final JPanel panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
g.setColor(color);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
jif = new JInternalFrame();
jif.add(panel);
jif.setVisible(true);
jif.setSize(300, 300);
pane.add(jif);
frame.add(pane);
frame.setVisible(true);
}
示例9: Test6505027
import javax.swing.JInternalFrame; //導入依賴的package包/類
public Test6505027(JFrame main) {
Container container = main;
if (INTERNAL) {
JInternalFrame frame = new JInternalFrame();
frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT);
frame.setVisible(true);
JDesktopPane desktop = new JDesktopPane();
desktop.add(frame, new Integer(1));
container.add(desktop);
container = frame;
}
if (TERMINATE) {
this.table.putClientProperty(KEY, Boolean.TRUE);
}
TableColumn column = this.table.getColumn(COLUMNS[1]);
column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS)));
container.add(BorderLayout.NORTH, new JTextField());
container.add(BorderLayout.CENTER, new JScrollPane(this.table));
}
示例10: getDesktopIcon
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Maps {@code JInternalFrame.getDesktopIcon()} through queue
*/
public JDesktopIcon getDesktopIcon() {
return (runMapping(new MapAction<JDesktopIcon>("getDesktopIcon") {
@Override
public JDesktopIcon map() {
return ((JInternalFrame) getSource()).getDesktopIcon();
}
}));
}
示例11: setGlassPane
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Maps {@code JInternalFrame.setGlassPane(Component)} through queue
*/
public void setGlassPane(final Component component) {
runMapping(new MapVoidAction("setGlassPane") {
@Override
public void map() {
((JInternalFrame) getSource()).setGlassPane(component);
}
});
}
示例12: getProgressMonitorContainer
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Returns the progress monitor container that is either a JDialog or a JInternFrame.
* @return the progress monitor container
*/
private Container getProgressMonitorContainer() {
if (progressMonitorContainer==null) {
Dimension defaultSize = new Dimension(570, 188);
if (this.parentDesktopPane==null) {
JDialog jDialog = new JDialog(this.owner);
jDialog.setSize(defaultSize);
jDialog.setResizable(false);
if (this.owner==null) {
jDialog.setAlwaysOnTop(true);
}
jDialog.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jDialog.setIconImage(this.iconImage.getImage());
}
jDialog.setContentPane(this.getJContentPane());
jDialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jDialog;
this.setLookAndFeel();
} else {
JInternalFrame jInternalFrame = new JInternalFrame();
jInternalFrame.setSize(defaultSize);
jInternalFrame.setResizable(false);
jInternalFrame.setTitle(this.windowTitle);
if (this.iconImage!=null) {
jInternalFrame.setFrameIcon(this.iconImage);
}
jInternalFrame.setContentPane(this.getJContentPane());
jInternalFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.progressMonitorContainer = jInternalFrame;
}
}
return progressMonitorContainer;
}
示例13: setFrameIcon
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Maps {@code JInternalFrame.setFrameIcon(Icon)} through queue
*/
public void setFrameIcon(final Icon icon) {
runMapping(new MapVoidAction("setFrameIcon") {
@Override
public void map() {
((JInternalFrame) getSource()).setFrameIcon(icon);
}
});
}
示例14: getHashMapEditorFrames
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* Returns a HashMap with all open editor windows.
* @return the local a HashMap with all open property windows
*/
public HashMap<String, JInternalFrame> getHashMapEditorFrames() {
if (this.editorFrames==null) {
editorFrames = new HashMap<String, JInternalFrame>();
}
return editorFrames;
}
示例15: notifyClose
import javax.swing.JInternalFrame; //導入依賴的package包/類
/**
* A component is closing. Some components need position and size
* to be saved.
*
* @param c The closing {@code Component}.
* @param frame The enclosing {@code JInternalFrame}.
*/
private void notifyClose(Component c, JInternalFrame frame) {
if (frame == null) return;
if (c instanceof FreeColPanel) {
FreeColPanel fcp = (FreeColPanel)c;
fcp.firePropertyChange("closing", false, true);
savePosition(fcp, frame.getLocation());
saveSize(fcp, fcp.getSize());
}
}