本文整理了Java中java.awt.Button.<init>()
方法的一些代码示例,展示了Button.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.<init>()
方法的具体详情如下:
包路径:java.awt.Button
类名称:Button
方法名:<init>
暂无
代码示例来源: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
public MessageDialog(Frame parent, String sender, String msg) {
super(parent, "Msg from " + sender);
Button ok=new Button("OK");
setLayout(new BorderLayout());
setBackground(Color.white);
ok.setFont(default_font);
text.setFont(default_font);
text.setEditable(false);
text.setText(msg);
ok.addActionListener(this);
add("Center", text);
add("South", ok);
setSize(300, 150);
Point my_loc=parent.getLocation();
my_loc.x+=50;
my_loc.y+=150;
setLocation(my_loc);
Toolkit.getDefaultToolkit().beep();
show();
}
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import java.awt.event.*;
public class Party {
public void buildInvite() {
Frame f = new Frame();
Label l = new Label("Party at Tim's");
Button b = new Button("You Bet");
Button c = new Button("Shoot Me");
Panel p = new Panel();
p.add(l);
p.add(b);
p.add(c);
f.add(p);
f.pack();
f.setVisible(true);
}
public static void main(String[] args) {
new Party().buildInvite();
}
}
代码示例来源:origin: javax.activation/activation
setLayout(panel_gb);
button_panel = new Panel();
save_button = new Button("SAVE");
button_panel.add(save_button);
addGridComponent(this,
save_button.addActionListener( this );
代码示例来源:origin: sc.fiji/VIB-lib
public void addCompletingButton( String key, String text ) {
Button newButton = new Button(text);
newButton.addActionListener(this);
completingButtons.add(newButton);
}
代码示例来源:origin: IanDarwin/javasrc
public void init() {
setBackground(Color.cyan); // see Graphics chapter.
Panel p = new Panel();
p.setBackground(Color.red);
p.add(applyB = new Button("Apply"));
applyB.setBackground(Color.white);
p.add(exitB = new Button("Exit"));
exitB.setForeground(Color.red);
add(p); // add (connect) "p" to "this", the Applet
}
}
代码示例来源:origin: wildfly/wildfly
public void go() {
try {
panel=new Panel();
sub_panel=new Panel();
resize(200, 200);
add("Center", panel);
clear_button=new Button("Clear");
clear_button.setFont(default_font);
clear_button.addActionListener(this);
leave_button=new Button("Exit");
leave_button.setFont(default_font);
leave_button.addActionListener(this);
mbr_label=new Label("0 mbr(s)");
mbr_label.setFont(default_font);
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class ButtonDemo extends Applet implements ActionListener {
public void init() {
setLayout(null)
Button yes= new Button("Yes");
yes.setBounds(0,30,30,60);
add(yes);
yes.addActionListener(this);
}
public void actionPerformed (ActionEvent ae) {
}
}
代码示例来源:origin: IanDarwin/javasrc
BordLayPanel() {
super("BordLayPanel");
Panel p;
setLayout(new BorderLayout());
add(BorderLayout.NORTH, p = new Panel());
p.setLayout(new FlowLayout());
p.add(new Label("FileName:"));
p.add(fileName = new TextField(40));
p.add(new Button("Load"));
// now you need to add an action listener to the button
add(BorderLayout.CENTER, main = new TextArea(24,80));
add(BorderLayout.SOUTH, status = new Label(""));
pack();
// Don't forget to add a window listener so the quit control works
}
代码示例来源:origin: com.h2database/h2
Panel mainPanel = new Panel(layout);
startBrowser = new Button("Start Browser");
startBrowser.setFocusable(false);
startBrowser.setActionCommand("console");
startBrowser.addActionListener(this);
startBrowser.setFont(font);
mainPanel.add(startBrowser, constraintsButton);
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
class MyApp implements ActionListener, Serializable
{
BigObjectThatShouldNotBeSerializedWithAButton bigOne;
Button aButton = new Button();
MyApp()
{
// Oops, now aButton has a listener with a reference
// to bigOne!
aButton.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
System.out.println("Hello There");
}
}
代码示例来源:origin: wildfly/wildfly
panel.setBackground(Color.white);
add("Center", panel);
Panel p = new Panel();
leave_button = new Button("Exit");
leave_button.setFont(default_font);
leave_button.addActionListener(this);
mbr_label = new Label("1 mbr(s)");
mbr_label.setFont(default_font);
代码示例来源:origin: sc.fiji/TransformJ_
private Button addButton(String label) {
final Button b = new Button(" "+label+" ");
b.addActionListener(this);
panel.add(b);
return b;
}
代码示例来源:origin: camunda/camunda-bpm-platform
setLayout(panel_gb);
button_panel = new Panel();
save_button = new Button("SAVE");
button_panel.add(save_button);
addGridComponent(this,
save_button.addActionListener( this );
代码示例来源:origin: sc.fiji/Stack_Manipulation
void addButton(String label) {
Button b = new Button(label);
b.addActionListener(this);
panel.add(b);
}
void addLabel(String label) {
代码示例来源:origin: net.imagej/ij
Panel makeButtonPanel(GenericDialog gd) {
Panel panel = new Panel();
//buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
colorButton = new Button("\"Show All\" Color...");
colorButton.addActionListener(this);
panel.add(colorButton);
return panel;
}
代码示例来源:origin: IanDarwin/javasrc
public void init() {
add(b1 = new Button("A button"));
b1.addActionListener(this);
add(b2 = new Button("Another button"));
b2.addActionListener(this);
}
代码示例来源:origin: imagej/ImageJA
Panel makeButtonPanel(GenericDialog gd) {
Panel panel = new Panel();
//buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
colorButton = new Button("\"Show All\" Color...");
colorButton.addActionListener(this);
panel.add(colorButton);
return panel;
}
代码示例来源:origin: sc.fiji/RandomJ_
private Button addButton(String label) {
final Button b = new Button(" "+label+" ");
b.addActionListener(this);
panel.add(b);
return b;
}
代码示例来源:origin: net.imagej/ij
/** Creates a panel containing "Save...", "Save..." and "Preview" buttons. */
Panel makeButtonPanel(GenericDialog gd) {
Panel buttons = new Panel();
buttons.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));
open = new Button("Open...");
open.addActionListener(this);
buttons.add(open);
save = new Button("Save...");
save.addActionListener(this);
buttons.add(save);
return buttons;
}
内容来源于网络,如有侵权,请联系作者删除!