java.awt.Panel.add()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(467)

本文整理了Java中java.awt.Panel.add()方法的一些代码示例,展示了Panel.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Panel.add()方法的具体详情如下:
包路径:java.awt.Panel
类名称:Panel
方法名:add

Panel.add介绍

暂无

代码示例

代码示例来源:origin: chewiebug/GCViewer

protected void initComponents() {
  Panel buttonPanel = new Panel();
  buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  JButton okButton = new JButton(LocalisationHelper.getString("button_ok"));
  okButton.setActionCommand(ACTION_OK);
  okButton.addActionListener(this);
  buttonPanel.add(okButton);
  
  getContentPane().add("South", buttonPanel);
}

代码示例来源:origin: gocd/gocd

aboutLabel[7] = new JLabel("");
Panel textPanel2 = new Panel(new GridLayout(labelCount, 1));
for (int i = 0; i < labelCount; i++) {
  aboutLabel[i].setHorizontalAlignment(JLabel.CENTER);
  textPanel2.add(aboutLabel[i]);

代码示例来源:origin: wildfly/wildfly

public void go() {
  try {
    panel=new Panel();
    sub_panel=new Panel();
    resize(200, 200);
    add("Center", panel);
    mbr_label=new Label("0 mbr(s)");
    mbr_label.setFont(default_font);
    sub_panel.add("South", clear_button);
    sub_panel.add("South", leave_button);
    sub_panel.add("South", mbr_label);
    add("South", sub_panel);
    panel.addMouseMotionListener(this);

代码示例来源:origin: wildfly/wildfly

button_panel.setLayout(new FlowLayout());
button_panel.setFont(def_font2);
button_panel.add(start);
button_panel.add(stop);
button_panel.add(clear);
button_panel.add(get_state);
button_panel.add(quit);
add("South", button_panel);

代码示例来源:origin: stackoverflow.com

**Panel p = new Panel ();
p.setLayout(new BorderLayout());//it's a container
p.addKeyListener (this);
p.add (dp);     
frame.getContentPane().add(p);**

代码示例来源:origin: FudanNLP/fnlp

Panel panel=new Panel();
panel.setLayout(null);
int sp=3;
int width=getWidth()-15;
jspOut.setBounds(sp, sp, width-sp*2, height*5/6);
jspIn.setBounds(sp, height*5/6+sp*2, width*4/5-sp*2, height*1/6);
panel.add(jspIn);
panel.add(jspOut);
panel.add(button);

代码示例来源:origin: gocd/gocd

public MacAboutBox() {
  super("");
  setResizable(false);
  addWindowListener(new SymWindow());
  getContentPane().setLayout(new BorderLayout(15, 15));
  List<JLabel> aboutLabels = new ArrayList<>();
  aboutLabels.add(emptyLabel());
  aboutLabels.add(titleLabel("Go Agent"));
  aboutLabels.add(bodyLabel("Bootstrapper Version " + getBootstrapperVersion()));
  aboutLabels.add(emptyLabel());
  aboutLabels.add(bodyLabel("Java Version " + System.getProperty("java.version")));
  aboutLabels.add(bodyLabel("Copyright (C) 2015 ThoughtWorks Inc."));
  aboutLabels.add(emptyLabel());
  Panel textPanel2 = new Panel(new GridLayout(aboutLabels.size(), 1));
  for (JLabel aboutLabel : aboutLabels) {
    textPanel2.add(aboutLabel);
  }
  getContentPane().add(textPanel2, BorderLayout.CENTER);
  pack();
  setLocation(FRAME_LEFT, FRAME_TOP);
  setSize(FRAME_WIDTH, FRAME_HEIGHT);
  setResizable(false);
}

代码示例来源:origin: io.snappydata/gemfire-jgroups

MyFrame(String title, DEADLOCK deadlock) {
this.deadlock=deadlock;
setSize(300, 200);
setTitle(title);
setBackground(Color.white);
setFont(new Font("Helvetica", Font.PLAIN, 12));
setLayout(new BorderLayout());
main_panel.setLayout(new GridLayout(0, 2));
main_panel.add(result);
main_panel.add(list);
button_panel.add(send);
button_panel.add(quit);
add("Center", main_panel);
add("South", button_panel);
addEventHandlers();
}

代码示例来源:origin: chewiebug/GCViewer

public AboutDialog(Frame f) {
  super(f, LocalisationHelper.getString("about_dialog_title"));
  Panel logoPanel = new Panel();
  ImageIcon logoIcon = ImageHelper.loadImageIcon(LocalisationHelper.getString("about_dialog_image"));
  JLabel la_icon = new JLabel(logoIcon);
  la_icon.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
  logoPanel.add(la_icon);
  versionPanel.add(buildDate, gridBagConstraints);
  Panel buttonPanel = new Panel();
  buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  if (UrlDisplayHelper.displayUrlIsSupported()) {
    JButton homePageButton = new JButton("Homepage");
    homePageButton.setActionCommand(ACTION_HOMEPAGE);
    homePageButton.addActionListener(this);
    buttonPanel.add(homePageButton);
  okButton.setActionCommand(ACTION_OK);
  okButton.addActionListener(this);
  buttonPanel.add(okButton);
  getContentPane().add("North", logoPanel);
  getContentPane().add("Center", versionPanel);

代码示例来源:origin: com.h2database/h2

Panel mainPanel = new Panel(layout);
mainPanel.add(label, constraintsLabel);
  urlText.setFocusable(false);
mainPanel.add(urlText, constraintsTextField);
startBrowser.addActionListener(this);
startBrowser.setFont(font);
mainPanel.add(startBrowser, constraintsButton);
frame.add(mainPanel, constraintsPanel);

代码示例来源:origin: org.scijava/scijava-ui-awt

@Override
public void set(final WidgetModel model) {
  super.set(model);
  getComponent().setLayout(new BorderLayout());
  path = new TextField(20);
  path.addTextListener(this);
  getComponent().add(path, BorderLayout.CENTER);
  browse = new Button("Browse");
  browse.addActionListener(this);
  getComponent().add(browse, BorderLayout.EAST);
  refreshWidget();
}

代码示例来源:origin: wildfly/wildfly

public SendDialog(Frame parent, Node dest, String src, RpcDispatcher disp) {
  super(parent, "Send message to " + dest.lbl + " at " + dest.addr, true);
  Panel p1=new Panel(), p2=new Panel();
  Button send=new Button("Send"), send_all=new Button("Send to all");
  Button cancel=new Button("Cancel");
  this.disp=disp;
  this.dest=dest;
  sender=src;
  send.setFont(default_font);
  send_all.setFont(default_font);
  cancel.setFont(default_font);
  msg.setFont(default_font);
  p1.setLayout(new BorderLayout());
  p1.add(msg);
  p2.setLayout(new FlowLayout());
  send.addActionListener(this);
  send_all.addActionListener(this);
  cancel.addActionListener(this);
  p2.add(send);
  p2.add(send_all);
  p2.add(cancel);
  add("Center", p1);
  add("South", p2);
  setSize(300, 150);
  Point my_loc=parent.getLocation();
  my_loc.x+=50;
  my_loc.y+=150;
  setLocation(my_loc);
  setVisible(true);
}

代码示例来源:origin: wildfly/wildfly

panel.setBackground(Color.white);
add("Center", panel);
Panel p = new Panel();
leave_button = new Button("Exit");
leave_button.setFont(default_font);
mbr_label = new Label("1 mbr(s)");
mbr_label.setFont(default_font);
p.add("South", leave_button);
p.add("South", mbr_label);
add("South", p);

代码示例来源:origin: javax.activation/activation

setLayout(panel_gb);
button_panel = new Panel();
button_panel.setLayout( new FlowLayout() );
save_button = new Button("SAVE");
button_panel.add(save_button);
addGridComponent(this,
     button_panel,

代码示例来源:origin: stackoverflow.com

Panel createPanel() {
 Panel p = new Panel();
 Label l = new Label("Heading");
 p.add(l);
 return p;
}

代码示例来源:origin: camunda/camunda-bpm-platform

setLayout(panel_gb);
button_panel = new Panel();
button_panel.setLayout( new FlowLayout() );
save_button = new Button("SAVE");
button_panel.add(save_button);
addGridComponent(this,
     button_panel,

代码示例来源:origin: stackoverflow.com

public class form extends JFrame{

public form(){
  Panel p=new Panel();
  final JButton b=new JButton("button");
  b.setToolTipText("HELLO");
  p.add(b);
  this.add(p);


}

代码示例来源:origin: stackoverflow.com

top.add(emailid);
     Panel p5 = new Panel();
     p5.setLayout(new GridLayout(1,3,1,1));
     p5.add(temailid);
     p5.add(city);
     p5.add(tcity);
     top.add(p5);
     top.add(address);
     Panel p6 = new Panel();
     p6.setLayout(new GridLayout());
     p6.add(taddress);
     top.add(p6);

代码示例来源:origin: stackoverflow.com

lbl = new JLabel();
Panel panel = new Panel();
panel.add(lbl);

代码示例来源:origin: ome/bio-formats_plugins

/** Makes AWT play nicely with Swing components. */
protected static Panel makeHeavyPanel(Component c) {
 Panel panel = new Panel();
 panel.setLayout(new BorderLayout());
 panel.add(c, BorderLayout.CENTER);
 return panel;
}

相关文章