本文整理匯總了Java中javax.swing.JInternalFrame.setVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java JInternalFrame.setVisible方法的具體用法?Java JInternalFrame.setVisible怎麽用?Java JInternalFrame.setVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JInternalFrame
的用法示例。
在下文中一共展示了JInternalFrame.setVisible方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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);
}
示例3: 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));
}
示例4: 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);
}
示例5: 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();
}
示例6: 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) {
}
}
示例7: 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) {
}
}
示例8: setupMethodsFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private void setupMethodsFrame() {
frameMethods = new JInternalFrame("Methods");
frameMethods.setResizable(true);
frameMethods.setIconifiable(true);
int fw = frameFields == null ? 0 : frameFields.getWidth();
frameMethods.setBounds(fw + frameClass.getWidth() + 11, 11, 180, 120);
frameMethods.setVisible(true);
frameMethods.setLayout(new BorderLayout());
methods = new JList<>();
methods.setCellRenderer(new MemberNodeRenderer());
methods.addMouseListener(new MemberNodeClickListener(this, node, methods));
DefaultListModel<MethodNode> model = new DefaultListModel<>();
for (MethodNode mn : node.methods) {
model.addElement(mn);
}
if (node.methods.size() == 0) {
methods.setVisibleRowCount(5);
methods.setPrototypeCellValue(new MethodNode(0, "Add_A_Method", "()Ljava/lang/Object;", null, null));
}
methods.setModel(model);
frameMethods.add(new JScrollPane(methods), BorderLayout.CENTER);
// TODO: Switch to table. A table may be bigger but allows for sorting
// of members.
//
// frameMethods.add(new JScrollPane(MemberTable.create(node.methods)),
// BorderLayout.CENTER);
frameMethods.pack();
}
示例9: 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) {
}
}
示例10: create
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private static JInternalFrame create(int index) {
String text = "test" + index; // NON-NLS: frame identification
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;
}
示例11: exibirFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
public static void exibirFrame(Painel painel, JInternalFrame frame) {
painel.getDesktopPane().add(frame);
frame.setVisible(true);
frame.toFront();
centralizar(painel, frame);
}
示例12: prepareControls
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
@Override
protected void prepareControls() {
JFrame frame = new JFrame("Glass Pane children test");
frame.setLayout(null);
Container contentPane = frame.getContentPane();
contentPane.setLayout(new BorderLayout());
super.propagateAWTControls(contentPane);
Container glassPane = (Container) frame.getRootPane().getGlassPane();
glassPane.setVisible(true);
glassPane.setLayout(null);
internalFrame = new JInternalFrame("Internal Frame", true);
internalFrame.setBounds(50, 0, 200, 100);
internalFrame.setVisible(true);
glassPane.add(internalFrame);
internalFrame.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
lwClicked = true;
}
});
frame.setSize(300, 180);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
示例13: 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
}
示例14: initialize
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
/**
* Método responsável por inicializar todos os componentes swing deste frame
*
*/
private void initialize() {
frmGereciamentoDeBanco = new JFrame();
frmGereciamentoDeBanco.setResizable(false);
frmGereciamentoDeBanco.setTitle("Sistema de Gereciamento de Banco");
frmGereciamentoDeBanco.setBounds(100, 100, 800, 600);
frmGereciamentoDeBanco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmGereciamentoDeBanco.getContentPane().setLayout(null);
frmGereciamentoDeBanco.setLocationRelativeTo(null);
JLabel lblBanco = new JLabel("Banco:");
lblBanco.setFont(new Font("Tahoma", Font.BOLD, 14));
lblBanco.setBounds(10, 11, 74, 23);
frmGereciamentoDeBanco.getContentPane().add(lblBanco);
JLabel lblAgencia = new JLabel("Agência:");
lblAgencia.setFont(new Font("Tahoma", Font.BOLD, 14));
lblAgencia.setBounds(10, 45, 74, 23);
frmGereciamentoDeBanco.getContentPane().add(lblAgencia);
btnManterClientes = new JButton("Manter Clientes");
btnManterClientes.setBounds(10, 89, 170, 37);
frmGereciamentoDeBanco.getContentPane().add(btnManterClientes);
btnOperaesBancarias = new JButton("Operações Bancarias");
btnOperaesBancarias.setBounds(190, 89, 170, 37);
btnOperaesBancarias.setEnabled(Boolean.FALSE);
frmGereciamentoDeBanco.getContentPane().add(btnOperaesBancarias);
lblBancoResult = new JLabel("...");
lblBancoResult.setFont(new Font("Tahoma", Font.BOLD, 14));
lblBancoResult.setBounds(94, 11, 480, 20);
frmGereciamentoDeBanco.getContentPane().add(lblBancoResult);
lblAgenciaResult = new JLabel("...");
lblAgenciaResult.setFont(new Font("Tahoma", Font.BOLD, 14));
lblAgenciaResult.setBounds(94, 45, 480, 20);
frmGereciamentoDeBanco.getContentPane().add(lblAgenciaResult);
JSeparator separator = new JSeparator();
separator.setBounds(10, 79, 764, 11);
frmGereciamentoDeBanco.getContentPane().add(separator);
panelInterno = new JDesktopPane();
panelInterno.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
panelInterno.setBounds(10, 137, 764, 414);
frmGereciamentoDeBanco.getContentPane().add(panelInterno);
panelInterno.setLayout(null);
frameInterno = new JInternalFrame("New JInternalFrame");
frameInterno.setBounds(10, 11, 744, 392);
panelInterno.add(frameInterno);
frameInterno.setVisible(false);
}
示例15: 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;
}