Package charvax.swing

Examples of charvax.swing.JLabel


        _cal = new GregorianCalendar(zone_);

        add(_yearField);
        _yearField.addKeyListener(this);
        _yearField.addFocusListener(this);
        add(new JLabel("/"));
        add(_monthField);
        _monthField.addKeyListener(this);
        _monthField.addFocusListener(this);
        add(new JLabel("/"));
        add(_dayField);
        _dayField.addKeyListener(this);
        _dayField.addFocusListener(this);
    }
View Full Code Here


        setJMenuBar(menubar);

        JPanel labelPanel = new JPanel();
        labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.Y_AXIS));
        labelPanel.add(new JLabel(
                "Use LEFT and RIGHT cursor keys to select a menu."));
        labelPanel.add(new JLabel("Use ENTER to invoke a menu or menu-item."));
        labelPanel.add(new JLabel("(You can also use the "
                + "underlined \"mnemonic key\" to invoke a menu.)"));
        labelPanel.add(new JLabel("Use BACKSPACE or ESC to dismiss a menu."));
        contentPane.add(labelPanel, BorderLayout.SOUTH);

        setLocation(0, 0);
        Toolkit tk = Toolkit.getDefaultToolkit();
        setSize(tk.getScreenColumns(), tk.getScreenRows());
View Full Code Here

        setLocation(3, 3);
        setSize(60, 20);
        Container contentPane = getContentPane();
        contentPane.setLayout(null);

        JLabel label0 = new JLabel(
                "Demonstrates how to lay components out manually");
        contentPane.add(label0);
        label0.setLocation(2, 2);

        JPanel panel1 = new JPanel();
        panel1.setLayout(null);
        contentPane.add(panel1);
        panel1.setLocation(2, 3);
        panel1.setSize(40, 6);
        panel1.setBorder(new TitledBorder("Panel1"));

        JLabel label1 = new JLabel("Label 1:");
        panel1.add(label1);
        label1.setLocation(1, 2);

        JTextField textfield1 = new JTextField("Text Field 1");
        panel1.add(textfield1);
        textfield1.setLocation(11, 2);

        JPanel panel2 = new JPanel();
        panel2.setLayout(null);
        contentPane.add(panel2);
        panel2.setLocation(2, 10);
        panel2.setSize(40, 6);
        panel2.setBorder(new TitledBorder("Panel2"));

        JLabel label2 = new JLabel("Label 2:");
        panel2.add(label2);
        label2.setLocation(1, 2);

        JTextField textfield2 = new JTextField("Text Field 2");
        panel2.add(textfield2);
        textfield2.setLocation(11, 2);
View Full Code Here

            setLayout(new BorderLayout());

            JPanel centerpan = new JPanel();
            centerpan.setBorder(new TitledBorder("Performance Status"));
            centerpan.setLayout(new BoxLayout(centerpan, BoxLayout.Y_AXIS));
            centerpan.add(new JLabel("Memory:           256.0 MB of RAM"));
            centerpan.add(new JLabel("System Resources: 50% free"));
            centerpan.add(new JLabel("File System:      32 bit"));
            centerpan.add(new JLabel("Virtual Memory:   32 bit"));
            centerpan.add(new JLabel("Disk Compression: Not Installed"));
            centerpan.add(new JLabel(
                    "Your system is configured for optimum performance"));

            JPanel southpan = new JPanel();
            southpan.setBorder(new TitledBorder("Advanced Settings"));
            southpan.add(new JButton("File System..."));
View Full Code Here

        ComboBoxPanel() {
            setLayout(new BorderLayout());
            setBorder(new TitledBorder("JComboBox"));

            add(new JLabel("Press ENTER to pop up the JComboBox"),
                    BorderLayout.NORTH);

            String[] colors = { "Red", "Blue", "Green", "Magenta", "Mauve",
                    "Orange", "Black", "White", "Brown"};
            _comboBox = new JComboBox(colors);
            _comboBox.setMaximumRowCount(5);
            _comboBox.addItemListener(this);
            add(_comboBox, BorderLayout.CENTER);

            JPanel southpan = new JPanel();
            southpan.add(new JLabel(" Selected item is: "));
            _comboBoxSelection = new JTextField(15);
            _comboBoxSelection.setEnabled(false);
            southpan.add(_comboBoxSelection);
            add(southpan, BorderLayout.SOUTH);
        }
View Full Code Here

        JListPanel() {
            setBorder(new TitledBorder("JList"));
            setLayout(new BorderLayout());

            add(new JLabel("Use UP, DOWN, PGUP, PGDN, HOME & END to navigate"),
                    BorderLayout.NORTH);

            String[] vehicles = { "Volkswagen", "Rolls-Royce", "Toyota",
                    "Chrysler", "Mercedes Benz", "Bentley", "Bugatti",
                    "Maserati", "Porsche"};
            DefaultListModel model = new DefaultListModel();
            int columns = 0;
            for (int i = 0; i < vehicles.length; i++) {
                model.addElement(vehicles[ i]);
                if (vehicles[ i].length() > columns)
                        columns = vehicles[ i].length();
            }
            model.addListDataListener(this);

            _vehicleList = new JList(model);
            _vehicleList.setVisibleRowCount(5);
            _vehicleList.setColumns(columns);
            _vehicleList.addListSelectionListener(this);
            JScrollPane scrollpane = new JScrollPane(_vehicleList);
            scrollpane.setViewportBorder(new TitledBorder("Vehicles"));
            add(scrollpane, BorderLayout.WEST);

            _selectionMode = new JCheckBox("Selection Mode = Multiple");
            _selectionMode.addItemListener(this);

            _deleteButton = new JButton("Delete selected item(s)");
            _deleteButton.setActionCommand("Delete");
            _deleteButton.addActionListener(this);

            JPanel eastpan = new JPanel();
            eastpan.setLayout(new BoxLayout(eastpan, BoxLayout.Y_AXIS));
            eastpan.add(new JLabel(""));
            eastpan.add(_selectionMode);
            eastpan.add(new JLabel(""));
            eastpan.add(_deleteButton);
            add(eastpan, BorderLayout.EAST);

            JPanel southpan = new JPanel();
            southpan.add(new JLabel("Selected item(s):"));

            _listSelection = new JTextField(30);
            _listSelection.setEnabled(false);
            southpan.add(_listSelection);
            add(southpan, BorderLayout.SOUTH);
View Full Code Here

        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.gridwidth = 2;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(1, 1, 1, 1);
        JLabel label = new JLabel(
                "Press START TASK to run a long task in a separate thread.");
        northpan.add(label, gbc);

        gbc.gridy = 1;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 0, 1);
        label = new JLabel(
                "While the task is running, press TAB and then enter some");
        northpan.add(label, gbc);

        gbc.gridy = 2;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 0, 1);
        label = new JLabel(
                "text in the TextField to verify that the user interface");
        northpan.add(label, gbc);

        gbc.gridy = 3;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 1, 1);
        label = new JLabel("is still responsive.");
        northpan.add(label, gbc);

        gbc.gridy = 4;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 0, 1);
        label = new JLabel(
                "The progress bar will start in indeterminate mode, indicating");
        northpan.add(label, gbc);

        gbc.gridy = 5;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 0, 1);
        label = new JLabel(
                "that the task duration is initially unknown; then it will");
        northpan.add(label, gbc);

        gbc.gridy = 6;
        gbc.gridwidth = 2;
        gbc.insets = new Insets(0, 1, 1, 1);
        label = new JLabel("change to determinate mode.");
        northpan.add(label, gbc);

        gbc.gridx = 0;
        gbc.gridy = 7;
        gbc.gridwidth = 1;
        gbc.anchor = GridBagConstraints.EAST;
        northpan.add(new JLabel("Enter some text here:"), gbc);

        gbc.gridx = 1;
        gbc.anchor = GridBagConstraints.WEST;
        northpan.add(new JTextField(20), gbc);
        gbc.insets = new Insets(0, 1, 1, 1);
View Full Code Here

        contentPane.setLayout(new BorderLayout()); // default layout for
                                                   // JDialog

        JPanel toppan = new JPanel();
        toppan.setBorder(new TitledBorder("North Panel"));
        toppan.add(new JLabel("north panel uses FlowLayout"));
        contentPane.add(toppan, BorderLayout.NORTH);

        JPanel westpan = new JPanel();
        westpan.setBorder(new TitledBorder("West Panel"));
        westpan.setLayout(new BoxLayout(westpan, BoxLayout.Y_AXIS));
        westpan.add(new JLabel("west panel uses BoxLayout"));
        westpan.add(new JTextField("JTextField #1."));
        westpan.add(new JTextField("JTextField #2."));
        westpan.add(new JTextField("JTextField #3."));
        westpan.add(new JTextField("JTextField #4."));
        westpan.add(new JTextField("JTextField #5."));
        contentPane.add(westpan, BorderLayout.WEST);

        JPanel eastpan = new JPanel();
        eastpan.setBorder(new TitledBorder("East Panel"));
        eastpan.add(new JTextField("A JTextField"));
        contentPane.add(eastpan, BorderLayout.EAST);

        JPanel centerpan = new JPanel();
        centerpan.setLayout(new BorderLayout());
        centerpan.setBorder(new TitledBorder("Center Panel"));
        centerpan.add(new JLabel("A label in the center"), BorderLayout.CENTER);
        contentPane.add(centerpan, BorderLayout.CENTER);

        JPanel southpan = new JPanel();
        southpan.setBorder(new TitledBorder("South Panel"));
        southpan.add(new JLabel("A label in the south: "));
        JButton okButton = new JButton("OK");
        okButton.addActionListener(this);
        southpan.add(okButton);
        contentPane.add(southpan, BorderLayout.SOUTH);
        okButton.setMnemonic(KeyEvent.VK_F10);
View Full Code Here

        toppan.add(button2);

        JPanel westpan = new JPanel();
        westpan.setBorder(new TitledBorder("West Panel"));
        westpan.setLayout(new BoxLayout(westpan, BoxLayout.Y_AXIS));
        JLabel label1 = new JLabel("Magenta label in west panel");
        westpan.add(label1);
        label1.setForeground(Color.magenta);
        JTextField textfield1 = new JTextField(
                "Cyan JTextField, red background");
        textfield1.setForeground(Color.cyan);
        textfield1.setBackground(Color.red);
        westpan.add(textfield1);

        JTextField whiteTextField = new JTextField("White JTextField");
        whiteTextField.setForeground(Color.white);
        westpan.add(whiteTextField);
        JTextField blueTextField = new JTextField("Blue JTextField");
        blueTextField.setForeground(Color.blue);
        westpan.add(blueTextField);
        JTextField yellowTextField = new JTextField("Yellow JTextField");
        yellowTextField.setForeground(Color.yellow);
        westpan.add(yellowTextField);
        JTextField blackTextField = new JTextField("Black JTextField");
        blackTextField.setForeground(Color.black);
        westpan.add(blackTextField);
        contentPane.add(westpan, BorderLayout.WEST);

        JPanel eastpan = new JPanel();
        eastpan.setForeground(Color.black);
        eastpan.setBorder(new TitledBorder("East Panel"));
        eastpan.add(new JTextField("A JTextField"));
        contentPane.add(eastpan, BorderLayout.EAST);

        JPanel centerpan = new JPanel();
        centerpan.setForeground(Color.white);
        centerpan.setBackground(Color.black);
        centerpan.setLayout(new BorderLayout());
        LineBorder centerpan_lineborder = new LineBorder(Color.green);
        TitledBorder centerpan_titledborder = new TitledBorder(
                centerpan_lineborder, "Green border, yellow title", 0, 0, null,
                Color.yellow);
        centerpan.setBorder(centerpan_titledborder);
        centerpan.add(new JLabel("A white label in the center"),
                BorderLayout.CENTER);
        contentPane.add(centerpan, BorderLayout.CENTER);

        JPanel southpan = new JPanel();
        southpan.setBorder(new TitledBorder("South Panel (white foreground)"));
        southpan.setBackground(Color.blue);
        southpan.setForeground(Color.white);
        JLabel labelsouth = new JLabel("A green label in the south panel ");
        labelsouth.setForeground(Color.green);
        southpan.add(labelsouth);
        JButton okButton = new JButton("OK");
        okButton.addActionListener(this);
        southpan.add(okButton);
        contentPane.add(southpan, BorderLayout.SOUTH);
View Full Code Here

        GridBagConstraints gbc = new GridBagConstraints();

        gbc.gridx = gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.EAST;
        centerpan.add(new JLabel("Last name: "), gbc);

        gbc.gridy = 1;
        centerpan.add(new JLabel("Address line 1: "), gbc);

        gbc.gridy = 2;
        centerpan.add(new JLabel("Address line 2: "), gbc);

        gbc.gridy = 3;
        centerpan.add(new JLabel("City: "), gbc);

        gbc.gridy = 4;
        centerpan.add(new JLabel("Postal code: "), gbc);

        gbc.gridy = 5;
        centerpan.add(new JLabel("State: "), gbc);

        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.anchor = GridBagConstraints.WEST;
        centerpan.add(lastnameField, gbc);

        gbc.gridx = 2;
        gbc.anchor = GridBagConstraints.EAST;
        centerpan.add(new JLabel(" Initials: "), gbc);

        gbc.gridx = 3;
        gbc.anchor = GridBagConstraints.WEST;
        centerpan.add(initialsField, gbc);
View Full Code Here

TOP

Related Classes of charvax.swing.JLabel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.