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

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

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

Panel.add介绍

暂无

代码示例

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

  1. protected void initComponents() {
  2. Panel buttonPanel = new Panel();
  3. buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  4. JButton okButton = new JButton(LocalisationHelper.getString("button_ok"));
  5. okButton.setActionCommand(ACTION_OK);
  6. okButton.addActionListener(this);
  7. buttonPanel.add(okButton);
  8. getContentPane().add("South", buttonPanel);
  9. }

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

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

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

  1. public void go() {
  2. try {
  3. panel=new Panel();
  4. sub_panel=new Panel();
  5. resize(200, 200);
  6. add("Center", panel);
  7. mbr_label=new Label("0 mbr(s)");
  8. mbr_label.setFont(default_font);
  9. sub_panel.add("South", clear_button);
  10. sub_panel.add("South", leave_button);
  11. sub_panel.add("South", mbr_label);
  12. add("South", sub_panel);
  13. panel.addMouseMotionListener(this);

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

  1. button_panel.setLayout(new FlowLayout());
  2. button_panel.setFont(def_font2);
  3. button_panel.add(start);
  4. button_panel.add(stop);
  5. button_panel.add(clear);
  6. button_panel.add(get_state);
  7. button_panel.add(quit);
  8. add("South", button_panel);

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

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

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

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

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

  1. public MacAboutBox() {
  2. super("");
  3. setResizable(false);
  4. addWindowListener(new SymWindow());
  5. getContentPane().setLayout(new BorderLayout(15, 15));
  6. List<JLabel> aboutLabels = new ArrayList<>();
  7. aboutLabels.add(emptyLabel());
  8. aboutLabels.add(titleLabel("Go Agent"));
  9. aboutLabels.add(bodyLabel("Bootstrapper Version " + getBootstrapperVersion()));
  10. aboutLabels.add(emptyLabel());
  11. aboutLabels.add(bodyLabel("Java Version " + System.getProperty("java.version")));
  12. aboutLabels.add(bodyLabel("Copyright (C) 2015 ThoughtWorks Inc."));
  13. aboutLabels.add(emptyLabel());
  14. Panel textPanel2 = new Panel(new GridLayout(aboutLabels.size(), 1));
  15. for (JLabel aboutLabel : aboutLabels) {
  16. textPanel2.add(aboutLabel);
  17. }
  18. getContentPane().add(textPanel2, BorderLayout.CENTER);
  19. pack();
  20. setLocation(FRAME_LEFT, FRAME_TOP);
  21. setSize(FRAME_WIDTH, FRAME_HEIGHT);
  22. setResizable(false);
  23. }

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

  1. MyFrame(String title, DEADLOCK deadlock) {
  2. this.deadlock=deadlock;
  3. setSize(300, 200);
  4. setTitle(title);
  5. setBackground(Color.white);
  6. setFont(new Font("Helvetica", Font.PLAIN, 12));
  7. setLayout(new BorderLayout());
  8. main_panel.setLayout(new GridLayout(0, 2));
  9. main_panel.add(result);
  10. main_panel.add(list);
  11. button_panel.add(send);
  12. button_panel.add(quit);
  13. add("Center", main_panel);
  14. add("South", button_panel);
  15. addEventHandlers();
  16. }

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

  1. public AboutDialog(Frame f) {
  2. super(f, LocalisationHelper.getString("about_dialog_title"));
  3. Panel logoPanel = new Panel();
  4. ImageIcon logoIcon = ImageHelper.loadImageIcon(LocalisationHelper.getString("about_dialog_image"));
  5. JLabel la_icon = new JLabel(logoIcon);
  6. la_icon.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
  7. logoPanel.add(la_icon);
  8. versionPanel.add(buildDate, gridBagConstraints);
  9. Panel buttonPanel = new Panel();
  10. buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
  11. if (UrlDisplayHelper.displayUrlIsSupported()) {
  12. JButton homePageButton = new JButton("Homepage");
  13. homePageButton.setActionCommand(ACTION_HOMEPAGE);
  14. homePageButton.addActionListener(this);
  15. buttonPanel.add(homePageButton);
  16. okButton.setActionCommand(ACTION_OK);
  17. okButton.addActionListener(this);
  18. buttonPanel.add(okButton);
  19. getContentPane().add("North", logoPanel);
  20. getContentPane().add("Center", versionPanel);

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

  1. Panel mainPanel = new Panel(layout);
  2. mainPanel.add(label, constraintsLabel);
  3. urlText.setFocusable(false);
  4. mainPanel.add(urlText, constraintsTextField);
  5. startBrowser.addActionListener(this);
  6. startBrowser.setFont(font);
  7. mainPanel.add(startBrowser, constraintsButton);
  8. frame.add(mainPanel, constraintsPanel);

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

  1. @Override
  2. public void set(final WidgetModel model) {
  3. super.set(model);
  4. getComponent().setLayout(new BorderLayout());
  5. path = new TextField(20);
  6. path.addTextListener(this);
  7. getComponent().add(path, BorderLayout.CENTER);
  8. browse = new Button("Browse");
  9. browse.addActionListener(this);
  10. getComponent().add(browse, BorderLayout.EAST);
  11. refreshWidget();
  12. }

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

  1. public SendDialog(Frame parent, Node dest, String src, RpcDispatcher disp) {
  2. super(parent, "Send message to " + dest.lbl + " at " + dest.addr, true);
  3. Panel p1=new Panel(), p2=new Panel();
  4. Button send=new Button("Send"), send_all=new Button("Send to all");
  5. Button cancel=new Button("Cancel");
  6. this.disp=disp;
  7. this.dest=dest;
  8. sender=src;
  9. send.setFont(default_font);
  10. send_all.setFont(default_font);
  11. cancel.setFont(default_font);
  12. msg.setFont(default_font);
  13. p1.setLayout(new BorderLayout());
  14. p1.add(msg);
  15. p2.setLayout(new FlowLayout());
  16. send.addActionListener(this);
  17. send_all.addActionListener(this);
  18. cancel.addActionListener(this);
  19. p2.add(send);
  20. p2.add(send_all);
  21. p2.add(cancel);
  22. add("Center", p1);
  23. add("South", p2);
  24. setSize(300, 150);
  25. Point my_loc=parent.getLocation();
  26. my_loc.x+=50;
  27. my_loc.y+=150;
  28. setLocation(my_loc);
  29. setVisible(true);
  30. }

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

  1. panel.setBackground(Color.white);
  2. add("Center", panel);
  3. Panel p = new Panel();
  4. leave_button = new Button("Exit");
  5. leave_button.setFont(default_font);
  6. mbr_label = new Label("1 mbr(s)");
  7. mbr_label.setFont(default_font);
  8. p.add("South", leave_button);
  9. p.add("South", mbr_label);
  10. add("South", p);

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

  1. setLayout(panel_gb);
  2. button_panel = new Panel();
  3. button_panel.setLayout( new FlowLayout() );
  4. save_button = new Button("SAVE");
  5. button_panel.add(save_button);
  6. addGridComponent(this,
  7. button_panel,

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

  1. Panel createPanel() {
  2. Panel p = new Panel();
  3. Label l = new Label("Heading");
  4. p.add(l);
  5. return p;
  6. }

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

  1. setLayout(panel_gb);
  2. button_panel = new Panel();
  3. button_panel.setLayout( new FlowLayout() );
  4. save_button = new Button("SAVE");
  5. button_panel.add(save_button);
  6. addGridComponent(this,
  7. button_panel,

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

  1. public class form extends JFrame{
  2. public form(){
  3. Panel p=new Panel();
  4. final JButton b=new JButton("button");
  5. b.setToolTipText("HELLO");
  6. p.add(b);
  7. this.add(p);
  8. }

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

  1. top.add(emailid);
  2. Panel p5 = new Panel();
  3. p5.setLayout(new GridLayout(1,3,1,1));
  4. p5.add(temailid);
  5. p5.add(city);
  6. p5.add(tcity);
  7. top.add(p5);
  8. top.add(address);
  9. Panel p6 = new Panel();
  10. p6.setLayout(new GridLayout());
  11. p6.add(taddress);
  12. top.add(p6);

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

  1. lbl = new JLabel();
  2. Panel panel = new Panel();
  3. panel.add(lbl);

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

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

相关文章