本文整理匯總了Java中javax.swing.JInternalFrame.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JInternalFrame.setSize方法的具體用法?Java JInternalFrame.setSize怎麽用?Java JInternalFrame.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JInternalFrame
的用法示例。
在下文中一共展示了JInternalFrame.setSize方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepareControls
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
@Override
protected void prepareControls() {
JDesktopPane desktopPane = new JDesktopPane();
JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
bottomFrame.setSize(220, 220);
super.propagateAWTControls(bottomFrame);
desktopPane.add(bottomFrame);
bottomFrame.setVisible(true);
JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
topFrame.setSize(200, 200);
topFrame.add(new JButton("LW Button") {
{
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
lwClicked = true;
}
});
}
});
desktopPane.add(topFrame);
topFrame.setVisible(true);
JFrame frame = new JFrame("Test Window");
frame.setSize(300, 300);
frame.setContentPane(desktopPane);
frame.setVisible(true);
locTopFrame = topFrame.getLocationOnScreen();
locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2);
}
示例2: 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);
}
示例3: createAndShowGUI
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private static void createAndShowGUI() {
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
desktopPane = new JDesktopPane();
desktopPane.setBackground(BACKGROUND_COLOR);
frame.add(desktopPane, BorderLayout.CENTER);
frame.setSize(FRAME_SIZE, FRAME_SIZE);
frame.setVisible(true);
internalFrame = new JInternalFrame("Test");
internalFrame.setSize(FRAME_SIZE / 2, FRAME_SIZE / 2);
desktopPane.add(internalFrame);
internalFrame.setVisible(true);
internalFrame.setResizable(true);
frame.setVisible(true);
}
示例4: createUI
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private static void createUI(String lookAndFeelString) {
internalFrame = new JInternalFrame("Internal", true, true, true, true);
internalFrame.setDefaultCloseOperation(
WindowConstants.DO_NOTHING_ON_CLOSE);
internalFrame.setSize(200, 200);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
desktopPane.add(internalFrame);
mainFrame = new JFrame(lookAndFeelString);
mainFrame.setSize(640, 480);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setContentPane(desktopPane);
mainFrame.setVisible(true);
internalFrame.setVisible(true);
}
示例5: 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;
}
示例6: prepareControls
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
/**
* Creating two JInternalFrames in JDesktopPanes. Put lightweight component into one frame and heavyweight into another.
*/
@Override
protected void prepareControls() {
JDesktopPane desktopPane = new JDesktopPane();
JFrame frame = new JFrame("Test Window");
frame.setSize(300, 300);
frame.setContentPane(desktopPane);
frame.setVisible(true);
JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
bottomFrame.setSize(220, 220);
desktopPane.add(bottomFrame);
bottomFrame.setVisible(true);
super.propagateAWTControls(bottomFrame);
JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
topFrame.setSize(200, 200);
JButton jbutton = new JButton("LW Button") {{
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
lwClicked = true;
}
});
}};
topFrame.add(jbutton);
desktopPane.add(topFrame);
topFrame.setVisible(true);
lLoc = jbutton.getLocationOnScreen();
lLoc.translate(jbutton.getWidth()/2, jbutton.getWidth()/2); //click at middle of the button
}
示例7: createAndShowGUI
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private static void createAndShowGUI() {
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.setBackground(DESKTOPPANE_COLOR);
internalFrame = new JInternalFrame("Test") {
@Override
public void paint(Graphics g) {
super.paint(g);
g.setColor(FRAME_COLOR);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
internalFrame.setSize(WIN_WIDTH / 3, WIN_HEIGHT / 3);
internalFrame.setVisible(true);
desktopPane.add(internalFrame);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(desktopPane, BorderLayout.CENTER);
frame.add(panel);
frame.setSize(WIN_WIDTH, WIN_HEIGHT);
frame.setVisible(true);
frame.requestFocus();
}
示例8: 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;
}