java类java.awt.Label的实例源码

LabelBeanInfo.java 文件源码 项目:incubator-netbeans 阅读 30 收藏 0 点赞 0 评论 0
@Override
public String getJavaInitializationString () {
    int i = ((Integer) getValue()).intValue();
    switch (i) {
    case java.awt.Label.RIGHT :  return "java.awt.Label.RIGHT"; // NOI18N
    case java.awt.Label.LEFT :   return "java.awt.Label.LEFT"; // NOI18N
    default:
    case java.awt.Label.CENTER : return "java.awt.Label.CENTER"; // NOI18N
    }
}
AppletGameContainer.java 文件源码 项目:Progetto-C 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Create a new panel to display the console output
 * 
 * @param e The exception causing the console to be displayed
 */
public ConsolePanel(Exception e) {
   setLayout(new BorderLayout());
   setBackground(Color.black);
   setForeground(Color.white);

   Font consoleFont = new Font("Arial", Font.BOLD, 14);

   Label slickLabel = new Label("SLICK CONSOLE", Label.CENTER);
   slickLabel.setFont(consoleFont);
   add(slickLabel, BorderLayout.PAGE_START);

   StringWriter sw = new StringWriter();
   e.printStackTrace(new PrintWriter(sw));

   textArea.setText(sw.toString());
   textArea.setEditable(false);
   add(textArea, BorderLayout.CENTER);

   // add a border on both sides of the console
   add(new Panel(), BorderLayout.LINE_START);
   add(new Panel(), BorderLayout.LINE_END);

   Panel bottomPanel = new Panel();
   bottomPanel.setLayout(new GridLayout(0, 1));
   Label infoLabel1 = new Label("An error occured while running the applet.", Label.CENTER);
   Label infoLabel2 = new Label("Plese contact support to resolve this issue.", Label.CENTER);
   infoLabel1.setFont(consoleFont);
   infoLabel2.setFont(consoleFont);
   bottomPanel.add(infoLabel1);
   bottomPanel.add(infoLabel2);
   add(bottomPanel, BorderLayout.PAGE_END);
}
LoginApplet.java 文件源码 项目:Servlet_Applet_Communication 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void init() {
this.setVisible(true);
this.setSize(500, 500);
this.setBackground(Color.green);
this.setLayout(new FlowLayout());

l1 = new Label("User Name");
l2 = new Label("Password");
tf1 = new TextField(20);
tf2 = new TextField(20);
tf2.setEchoChar('*');
b = new Button("Login");
b.addActionListener(this);

Font font = new Font("arial", Font.BOLD, 25);
l1.setFont(font);
l2.setFont(font);
tf1.setFont(font);
tf2.setFont(font);
b.setFont(font);

this.add(l1);
this.add(tf1);
this.add(l2);
this.add(tf2);
this.add(b);

}
AppletGameContainer.java 文件源码 项目:BaseClient 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Create a new panel to display the console output
 * 
 * @param e The exception causing the console to be displayed
 */
public ConsolePanel(Exception e) {
   setLayout(new BorderLayout());
   setBackground(Color.black);
   setForeground(Color.white);

   Font consoleFont = new Font("Arial", Font.BOLD, 14);

   Label slickLabel = new Label("SLICK CONSOLE", Label.CENTER);
   slickLabel.setFont(consoleFont);
   add(slickLabel, BorderLayout.PAGE_START);

   StringWriter sw = new StringWriter();
   e.printStackTrace(new PrintWriter(sw));

   textArea.setText(sw.toString());
   textArea.setEditable(false);
   add(textArea, BorderLayout.CENTER);

   // add a border on both sides of the console
   add(new Panel(), BorderLayout.LINE_START);
   add(new Panel(), BorderLayout.LINE_END);

   Panel bottomPanel = new Panel();
   bottomPanel.setLayout(new GridLayout(0, 1));
   Label infoLabel1 = new Label("An error occured while running the applet.", Label.CENTER);
   Label infoLabel2 = new Label("Plese contact support to resolve this issue.", Label.CENTER);
   infoLabel1.setFont(consoleFont);
   infoLabel2.setFont(consoleFont);
   bottomPanel.add(infoLabel1);
   bottomPanel.add(infoLabel2);
   add(bottomPanel, BorderLayout.PAGE_END);
}
StereoMatchingFrame.java 文件源码 项目:jaer 阅读 19 收藏 0 点赞 0 评论 0
/** Creates new form StereoMatchingViewer */
public StereoMatchingFrame(AEChip chip, int maxDisp) {
    this.chip = chip;
    this.maxDisp = maxDisp;
    initComponents();
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints layoutConstraints = new GridBagConstraints();
    layoutConstraints.anchor = GridBagConstraints.NORTHWEST;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;

    setLayout(layout);
    labelDisp = new Label("Disparity: " + 0);
    layout.setConstraints(labelDisp, layoutConstraints);
    add(labelDisp);
    labelSmc = new Label("Matching matrix");
    layout.setConstraints(labelSmc, layoutConstraints);
    add(labelSmc);
    smc = new StereoMatchingCanvas(chip);
    layout.setConstraints(smc, layoutConstraints);
    add(smc);
    labelScd = new Label("Accumulated disparity values");
    layout.setConstraints(labelScd, layoutConstraints);
    add(labelScd);
    sdc = new StereoDisparitiesCanvas(maxDisp);
    layout.setConstraints(sdc, layoutConstraints);
    add(sdc);

    setPreferredSize(null);
    pack();
}
DitherTest.java 文件源码 项目:OpenJSharp 阅读 27 收藏 0 点赞 0 评论 0
public DitherControls(DitherTest app, int s, int e, DitherMethod type,
        boolean vertical) {
    applet = app;
    setLayout(dcLayout);
    add(new Label(vertical ? "Vertical" : "Horizontal"));
    add(choice = new Choice());
    for (DitherMethod m : DitherMethod.values()) {
        choice.addItem(m.toString().substring(0, 1)
                + m.toString().substring(1).toLowerCase());
    }
    choice.select(type.ordinal());
    add(start = new CardinalTextField(Integer.toString(s), 4));
    add(end = new CardinalTextField(Integer.toString(e), 4));
}
LWLabelPeer.java 文件源码 项目:OpenJSharp 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Converts {@code Label} alignment constant to the {@code JLabel} constant.
 * If wrong Label alignment provided returns default alignment.
 *
 * @param alignment {@code Label} constant.
 *
 * @return {@code JLabel} constant.
 */
private static int convertAlignment(final int alignment) {
    switch (alignment) {
        case Label.CENTER:
            return SwingConstants.CENTER;
        case Label.RIGHT:
            return SwingConstants.RIGHT;
        default:
            return SwingConstants.LEFT;
    }
}
PiParallelAWT.java 文件源码 项目:apfloat 阅读 20 收藏 0 点赞 0 评论 0
@Override
protected void initThreads(Container container, GridBagConstraints constraints)
{
    this.threadsLabel = new Label("Threads:");
    container.add(this.threadsLabel, constraints);

    this.threadsField = new TextField(ApfloatContext.getContext().getProperty(ApfloatContext.NUMBER_OF_PROCESSORS), 5);
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    container.add(this.threadsField, constraints);
}
PiGUI.java 文件源码 项目:apfloat 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Default constructor.
 */

protected PiGUI()
{
    super("Pi calculator");
    setSize(720, 540);

    addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent windowEvent)
        {
            setVisible(false);
            dispose();
            System.exit(0);
        }
    });

    setLayout(new BorderLayout());

    this.statusLabel = new Label();

    add(getContents(), BorderLayout.NORTH);
    add(this.statusLabel, BorderLayout.SOUTH);

    setVisible(true);
}
DitherTest.java 文件源码 项目:jdk8u-jdk 阅读 28 收藏 0 点赞 0 评论 0
public DitherControls(DitherTest app, int s, int e, DitherMethod type,
        boolean vertical) {
    applet = app;
    setLayout(dcLayout);
    add(new Label(vertical ? "Vertical" : "Horizontal"));
    add(choice = new Choice());
    for (DitherMethod m : DitherMethod.values()) {
        choice.addItem(m.toString().substring(0, 1)
                + m.toString().substring(1).toLowerCase());
    }
    choice.select(type.ordinal());
    add(start = new CardinalTextField(Integer.toString(s), 4));
    add(end = new CardinalTextField(Integer.toString(e), 4));
}


问题


面经


文章

微信
公众号

扫码关注公众号