本文整理匯總了Java中javax.swing.JInternalFrame.setSelected方法的典型用法代碼示例。如果您正苦於以下問題:Java JInternalFrame.setSelected方法的具體用法?Java JInternalFrame.setSelected怎麽用?Java JInternalFrame.setSelected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JInternalFrame
的用法示例。
在下文中一共展示了JInternalFrame.setSelected方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerAtDesktopAndSetVisible
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
/**
* Register at the graph desktop and set this extended JInternalFrame visible.
* @see JDesktopPane
* @param jDesktopLayer the layer in which the JInternaFrame has to be added (e.g. JDesktopPane.PALETTE_LAYER)
*/
protected void registerAtDesktopAndSetVisible(Object jDesktopLayer) {
// --- Does the dialog for that component already exists? ---------
JInternalFrame compProps = this.graphDesktop.getEditor(this.getTitle());
if (compProps!=null) {
try {
// --- Make visible, if invisible ---------
if (compProps.isVisible()==false) compProps.setVisible(true);
// --- Move to front ----------------------
compProps.moveToFront();
// --- Set selected -----------------------
compProps.setSelected(true);
} catch (PropertyVetoException pve) {
pve.printStackTrace();
}
} else {
this.graphDesktop.add(this, jDesktopLayer);
this.graphDesktop.registerEditor(this, this.isRemindAsLastOpenedEditor());
this.setVisible(true);
}
}
示例2: newDocument
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public void newDocument() {
JInternalFrame doc = new MetalworksDocumentFrame();
desktop.add(doc, DOCLAYER);
try {
doc.setVisible(true);
doc.setSelected(true);
} catch (java.beans.PropertyVetoException e2) {
}
}
示例3: openHelpWindow
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public void openHelpWindow() {
JInternalFrame help = new MetalworksHelp();
desktop.add(help, HELPLAYER);
try {
help.setVisible(true);
help.setSelected(true);
} catch (java.beans.PropertyVetoException e2) {
}
}
示例4: openInBox
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public void openInBox() {
JInternalFrame doc = new MetalworksInBox();
desktop.add(doc, DOCLAYER);
try {
doc.setVisible(true);
doc.setSelected(true);
} catch (java.beans.PropertyVetoException e2) {
}
}
示例5: activateFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public void activateFrame(JInternalFrame f) {
JInternalFrame currentFrame = currentFrameRef != null ?
currentFrameRef.get() : null;
try {
super.activateFrame(f);
if (currentFrame != null && f != currentFrame) {
// If the current frame is maximized, transfer that
// attribute to the frame being activated.
if (currentFrame.isMaximum() &&
(f.getClientProperty("JInternalFrame.frameType") !=
"optionDialog") ) {
//Special case. If key binding was used to select next
//frame instead of minimizing the icon via the minimize
//icon.
if (!currentFrame.isIcon()) {
currentFrame.setMaximum(false);
if (f.isMaximizable()) {
if (!f.isMaximum()) {
f.setMaximum(true);
} else if (f.isMaximum() && f.isIcon()) {
f.setIcon(false);
} else {
f.setMaximum(false);
}
}
}
}
if (currentFrame.isSelected()) {
currentFrame.setSelected(false);
}
}
if (!f.isSelected()) {
f.setSelected(true);
}
} catch (PropertyVetoException e) {}
if (f != currentFrame) {
currentFrameRef = new WeakReference<JInternalFrame>(f);
}
}
示例6: activateFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public void activateFrame(JInternalFrame f) {
JInternalFrame currentFrame = currentFrameRef != null ?
currentFrameRef.get() : null;
try {
super.activateFrame(f);
if (currentFrame != null && f != currentFrame) {
// If the current frame is maximized, transfer that
// attribute to the frame being activated.
if (!currentFrame.isClosed() && currentFrame.isMaximum() &&
(f.getClientProperty("JInternalFrame.frameType") !=
"optionDialog") ) {
//Special case. If key binding was used to select next
//frame instead of minimizing the icon via the minimize
//icon.
if (!currentFrame.isIcon()) {
currentFrame.setMaximum(false);
if (f.isMaximizable()) {
if (!f.isMaximum()) {
f.setMaximum(true);
} else if (f.isMaximum() && f.isIcon()) {
f.setIcon(false);
} else {
f.setMaximum(false);
}
}
}
}
if (currentFrame.isSelected()) {
currentFrame.setSelected(false);
}
}
if (!f.isSelected()) {
f.setSelected(true);
}
} catch (PropertyVetoException e) {}
if (f != currentFrame) {
currentFrameRef = new WeakReference<JInternalFrame>(f);
}
}
示例7: addAsFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
/**
* Adds a component on this Canvas inside a frame.
*
* @param comp The component to add to the canvas.
* @param toolBox Should be set to true if the resulting frame is
* used as a toolbox (that is: it should not be counted as a
* frame).
* @param popupPosition A preferred {@code PopupPosition}.
* @param resizable Whether this component can be resized.
* @return The {@code JInternalFrame} that was created and added.
*/
private JInternalFrame addAsFrame(JComponent comp, boolean toolBox,
PopupPosition popupPosition,
boolean resizable) {
final int FRAME_EMPTY_SPACE = 60;
final JInternalFrame f = (toolBox) ? new ToolBoxFrame()
: new JInternalFrame();
if (f.getContentPane() instanceof JComponent) {
JComponent c = (JComponent) f.getContentPane();
c.setOpaque(false);
c.setBorder(null);
}
if (comp.getBorder() != null) {
if (comp.getBorder() instanceof EmptyBorder) {
f.setBorder(Utility.blankBorder(10, 10, 10, 10));
} else {
f.setBorder(comp.getBorder());
comp.setBorder(Utility.blankBorder(5, 5, 5, 5));
}
} else {
f.setBorder(null);
}
final FrameMotionListener fml = new FrameMotionListener(f);
comp.addMouseMotionListener(fml);
comp.addMouseListener(fml);
if (f.getUI() instanceof BasicInternalFrameUI) {
BasicInternalFrameUI biu = (BasicInternalFrameUI) f.getUI();
biu.setNorthPane(null);
biu.setSouthPane(null);
biu.setWestPane(null);
biu.setEastPane(null);
}
f.getContentPane().add(comp);
f.setOpaque(false);
f.pack();
int width = f.getWidth();
int height = f.getHeight();
if (width > getWidth() - FRAME_EMPTY_SPACE) {
width = Math.min(width, getWidth());
}
if (height > getHeight() - FRAME_EMPTY_SPACE) {
height = Math.min(height, getHeight());
}
f.setSize(width, height);
Point p = chooseLocation(comp, width, height, popupPosition);
f.setLocation(p);
this.add(f, MODAL_LAYER);
f.setName(comp.getClass().getSimpleName());
f.setFrameIcon(null);
f.setVisible(true);
f.setResizable(resizable);
try {
f.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
return f;
}