Example usage for java.awt Label RIGHT

List of usage examples for java.awt Label RIGHT

Introduction

In this page you can find the example usage for java.awt Label RIGHT.

Prototype

int RIGHT

To view the source code for java.awt Label RIGHT.

Click Source Link

Document

Indicates that the label should be right justified.

Usage

From source file:WebCrawler.java

public void init() {

    // set up the main UI panel
    panelMain = new Panel();
    panelMain.setLayout(new BorderLayout(5, 5));

    // text entry components
    Panel panelEntry = new Panel();
    panelEntry.setLayout(new BorderLayout(5, 5));

    Panel panelURL = new Panel();
    panelURL.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelURL = new Label("Starting URL: ", Label.RIGHT);
    panelURL.add(labelURL);//from  ww  w  .  j a va2 s .  com
    textURL = new TextField("", 40);
    panelURL.add(textURL);
    panelEntry.add("North", panelURL);

    Panel panelType = new Panel();
    panelType.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelType = new Label("Content type: ", Label.RIGHT);
    panelType.add(labelType);
    choiceType = new Choice();
    choiceType.addItem("text/html");
    choiceType.addItem("audio/basic");
    choiceType.addItem("audio/au");
    choiceType.addItem("audio/aiff");
    choiceType.addItem("audio/wav");
    choiceType.addItem("video/mpeg");
    choiceType.addItem("video/x-avi");
    panelType.add(choiceType);
    panelEntry.add("South", panelType);

    panelMain.add("North", panelEntry);

    // list of result URLs
    Panel panelListButtons = new Panel();
    panelListButtons.setLayout(new BorderLayout(5, 5));

    Panel panelList = new Panel();
    panelList.setLayout(new BorderLayout(5, 5));
    Label labelResults = new Label("Search results");
    panelList.add("North", labelResults);
    Panel panelListCurrent = new Panel();
    panelListCurrent.setLayout(new BorderLayout(5, 5));
    listMatches = new List(10);
    panelListCurrent.add("North", listMatches);
    labelStatus = new Label("");
    panelListCurrent.add("South", labelStatus);
    panelList.add("South", panelListCurrent);

    panelListButtons.add("North", panelList);

    // control buttons
    Panel panelButtons = new Panel();
    Button buttonSearch = new Button(SEARCH);
    buttonSearch.addActionListener(this);
    panelButtons.add(buttonSearch);
    Button buttonStop = new Button(STOP);
    buttonStop.addActionListener(this);
    panelButtons.add(buttonStop);

    panelListButtons.add("South", panelButtons);

    panelMain.add("South", panelListButtons);

    add(panelMain);
    setVisible(true);

    repaint();

    // initialize search data structures
    vectorToSearch = new Vector();
    vectorSearched = new Vector();
    vectorMatches = new Vector();

    // set default for URL access
    URLConnection.setDefaultAllowUserInteraction(false);
}

From source file:width.java

 public void init() {
     GridBagLayout gridBag = new GridBagLayout();
     GridBagConstraints c = new GridBagConstraints();

     setLayout(gridBag);/*from   w  w w .  ja va  2s.c om*/

     Label receiverLabel = new Label("Receiver name:", 
                                     Label.RIGHT);
     gridBag.setConstraints(receiverLabel, c);
     add(receiverLabel);

     nameField = new TextField(getParameter("RECEIVERNAME"),
                                            10);
     c.fill = GridBagConstraints.HORIZONTAL;
     gridBag.setConstraints(nameField, c);
     add(nameField);
     nameField.addActionListener(this);

     Button button = new Button("Send message");
     c.gridwidth = GridBagConstraints.REMAINDER; //end row
     c.anchor = GridBagConstraints.WEST; //stick to the 
                                         //text field
     c.fill = GridBagConstraints.NONE; //keep the button 
                                       //small
     gridBag.setConstraints(button, c);
     add(button);
     button.addActionListener(this);

     status = new TextArea(5, 60);
     status.setEditable(false);
     c.anchor = GridBagConstraints.CENTER; //reset to the default
     c.fill = GridBagConstraints.BOTH; //make this big
     c.weightx = 1.0;
     c.weighty = 1.0;
     gridBag.setConstraints(status, c);
     add(status);

     myName = getParameter("NAME");
     Label senderLabel = new Label("(My name is " + myName + ".)",
                                   Label.CENTER);
     c.weightx = 0.0;
     c.weighty = 0.0;
     gridBag.setConstraints(senderLabel, c);
     add(senderLabel);

newline = System.getProperty("line.separator");
 }

From source file:QuoteServerThread.java

public void init() {
        //Initialize networking stuff.
        String host = getCodeBase().getHost();

        try {/*from ww  w . j a va2  s .c  o  m*/
            address = InetAddress.getByName(host);
        } catch (UnknownHostException e) {
            System.out.println("Couldn't get Internet address: Unknown host");
            // What should we do?
        }

        try {
            socket = new DatagramSocket();
        } catch (IOException e) {
            System.out.println("Couldn't create new DatagramSocket");
            return;
        }

        //Set up the UI.
        GridBagLayout gridBag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridBag);

        Label l1 = new Label("Quote of the Moment:", Label.CENTER);
        c.anchor = GridBagConstraints.SOUTH;
        c.gridwidth = GridBagConstraints.REMAINDER;
        gridBag.setConstraints(l1, c);
        add(l1);

        display = new Label("(no quote received yet)", Label.CENTER);
        c.anchor = GridBagConstraints.NORTH;
        c.weightx = 1.0;
        c.fill = GridBagConstraints.HORIZONTAL;
        gridBag.setConstraints(display, c);
        add(display);

        Label l2 = new Label("Enter the port (on host " + host + ") to send the request to:", Label.RIGHT);
        c.anchor = GridBagConstraints.SOUTH;
        c.gridwidth = 1;
        c.weightx = 0.0;
        c.weighty = 1.0;
        c.fill = GridBagConstraints.NONE;
        gridBag.setConstraints(l2, c);
        add(l2);

        portField = new TextField(6);
        gridBag.setConstraints(portField, c);
        add(portField);

        Button button = new Button("Send");
        gridBag.setConstraints(button, c);
        add(button);

        portField.addActionListener(this);
        button.addActionListener(this);
    }

From source file:TalkServerThread.java

public void init() {
        //Get the address of the host we came from.
        host = getCodeBase().getHost();//from ww w  .  ja  va 2 s  .  co  m

        //Set up the UI.
        GridBagLayout gridBag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridBag);

        message = new TextField("");
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = GridBagConstraints.REMAINDER;
        gridBag.setConstraints(message, c);
        message.addActionListener(this);
        add(message);

        display = new TextArea(10, 40);
        display.setEditable(false);
        c.weightx = 1.0;
        c.weighty = 1.0;
        c.fill = GridBagConstraints.BOTH;
        gridBag.setConstraints(display, c);
        add(display);

        Label l = new Label("Enter the port (on host " + host + ") to send the request to:", Label.RIGHT);
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = 1;
        c.weightx = 0.0;
        c.weighty = 0.0;
        gridBag.setConstraints(l, c);
        add(l);

        portField = new TextField(6);
        c.fill = GridBagConstraints.NONE;
        gridBag.setConstraints(portField, c);
        portField.addActionListener(this);
        add(portField);

        button = new Button("Connect");
        gridBag.setConstraints(button, c);
        button.addActionListener(this);
        add(button);

        newline = System.getProperty("line.separator");
    }

From source file:CircleOfSquares.java

LabeledRegister(String labelText) {

    setLayout(new BorderLayout(5, 5));

    registerContents = new ColoredLabel("00000000", Label.CENTER, Color.lightGray);
    registerContents.setFont(new Font("TimesRoman", Font.PLAIN, 11));

    Label title = new Label(labelText, Label.RIGHT);
    title.setFont(new Font("Helvetica", Font.ITALIC, 11));

    add("East", registerContents);
    add("Center", title);
}

From source file:CircleOfSquares.java

MemoryView(int methodAreaMemSectionSize) {

    setLayout(new GridLayout(memoryLocationsVisibleCount, 4));

    setBackground(Color.lightGray);
    Font plainFont = new Font("TimesRoman", Font.PLAIN, 11);
    setFont(plainFont);//from   w  ww .  j a  va 2s . co  m

    Font italicFont = new Font("TimesRoman", Font.ITALIC, 11);

    for (int i = 0; i < memoryLocationsVisibleCount; ++i) {

        pointer[i] = new Label("", Label.RIGHT);
        pointer[i].setFont(italicFont);
        add(pointer[i]);

        address[i] = new Label("", Label.CENTER);
        add(address[i]);

        byteValue[i] = new Label("", Label.CENTER);
        add(byteValue[i]);

        logicalValue[i] = new Label("", Label.LEFT);
        add(logicalValue[i]);
    }
}

From source file:CircleOfSquares.java

StackMemoryView() {

    int[] hComponentCellWidths = new int[4];
    hComponentCellWidths[0] = 2;//from w  ww.ja v  a 2 s.  co m
    hComponentCellWidths[1] = 2;
    hComponentCellWidths[2] = 2;
    hComponentCellWidths[3] = 3;
    setLayout(new GridSnapLayout(memoryLocationsVisibleCount, 9, hComponentCellWidths));

    setBackground(Color.lightGray);
    Font plainFont = new Font("TimesRoman", Font.PLAIN, 11);
    setFont(plainFont);

    Font italicFont = new Font("TimesRoman", Font.ITALIC, 11);

    for (int i = memoryLocationsVisibleCount - 1; i >= 0; --i) {

        pointer[i] = new Label("", Label.RIGHT);
        pointer[i].setFont(italicFont);
        add(pointer[i]);

        address[i] = new Label("", Label.CENTER);
        add(address[i]);

        wordValue[i] = new Label("", Label.CENTER);
        add(wordValue[i]);

        logicalValue[i] = new Label("", Label.CENTER);
        add(logicalValue[i]);
    }
}

From source file:JVMSimulator.java

MemoryView(int methodAreaMemSectionSize) {

    int[] hComponentCellWidths = new int[4];
    hComponentCellWidths[0] = 2;//from  w w  w .  j  av  a2s  .com
    hComponentCellWidths[1] = 2;
    hComponentCellWidths[2] = 2;
    hComponentCellWidths[3] = 3;
    setLayout(new GridSnapLayout(memoryLocationsVisibleCount, 9, hComponentCellWidths));

    setBackground(Color.lightGray);
    Font plainFont = new Font("TimesRoman", Font.PLAIN, 11);
    setFont(plainFont);

    Font italicFont = new Font("TimesRoman", Font.ITALIC, 11);

    for (int i = 0; i < memoryLocationsVisibleCount; ++i) {

        pointer[i] = new Label("", Label.RIGHT);
        pointer[i].setFont(italicFont);
        add(pointer[i]);

        address[i] = new Label("", Label.CENTER);
        add(address[i]);

        byteValue[i] = new Label("", Label.CENTER);
        add(byteValue[i]);

        logicalValue[i] = new Label("", Label.LEFT);
        add(logicalValue[i]);
    }
}