本文整理匯總了Java中javax.swing.JInternalFrame.add方法的典型用法代碼示例。如果您正苦於以下問題:Java JInternalFrame.add方法的具體用法?Java JInternalFrame.add怎麽用?Java JInternalFrame.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JInternalFrame
的用法示例。
在下文中一共展示了JInternalFrame.add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupFieldsFrame
import javax.swing.JInternalFrame; //導入方法依賴的package包/類
private void setupFieldsFrame() {
frameFields = new JInternalFrame("Fields");
frameFields.setResizable(true);
frameFields.setIconifiable(true);
frameFields.setBounds(frameClass.getWidth() + 11, 11, 180, 140);
frameFields.setVisible(true);
frameFields.setLayout(new BorderLayout());
fields = new JList<>();
fields.setCellRenderer(new MemberNodeRenderer());
fields.addMouseListener(new MemberNodeClickListener(this, node, fields));
DefaultListModel<FieldNode> model = new DefaultListModel<>();
for (FieldNode fn : node.fields) {
model.addElement(fn);
}
if (node.fields.size() == 0) {
fields.setVisibleRowCount(5);
fields.setPrototypeCellValue(new FieldNode(0, "Add_A_Field", "Ljava/lang/Object;", null, null));
}
fields.setModel(model);
frameFields.add(new JScrollPane(fields), BorderLayout.CENTER);
frameFields.pack();
}
示例2: 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);
}
示例3: 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);
}
示例4: 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();
}
示例5: 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
}