Java Code Examples for java.awt.Frame#setTitle()

The following examples show how to use java.awt.Frame#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UILauncher.java    From JPPF with Apache License 2.0 6 votes vote down vote up
/**
 * Load the UI from the specified path to an XML descriptor.
 * @param src the path tot he XML docuemnt to load
 * @param type the type of the path: url or file.
 * @return the root {@link JComponent} of the admin console.
 * @since 5.0
 */
private synchronized static JComponent loadUI(final String src, final String type) {
  if (consoleComponent == null) {
    OptionElement elt = null;
    try {
      final Frame frame = new JFrame();
      OptionsHandler.setMainWindow(frame);
      frame.addWindowListener(new WindowClosingListener());
      if ("url".equalsIgnoreCase(type)) elt = OptionsHandler.addPageFromURL(src, null);
      else elt = OptionsHandler.addPageFromXml(src);
      frame.add(elt.getUIComponent());
      OptionsHandler.loadPreferences();
      frame.setTitle(elt.getLabel());
      final String iconPath = elt.getIconPath();
      frame.setIconImage(GuiUtils.loadIcon(iconPath != null ? iconPath : GuiUtils.JPPF_ICON).getImage());
      OptionsHandler.loadMainWindowAttributes(OptionsHandler.getPreferences().node(elt.getName()));
      OptionsHandler.getBuilder().triggerInitialEvents(elt);
    } catch (final Exception e) {
      e.printStackTrace();
      log.error(e.getMessage(), e);
    }
    consoleComponent = (elt == null) ? null : elt.getUIComponent();
  }
  return consoleComponent;
}
 
Example 2
Source File: DisabledUndoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void initTestWindow() {
    mainFrame = new Frame();
    p1 = new Panel();
    mainFrame.setTitle("TestWindow");
    mainFrame.setBounds(700, 10, 400, 100);

    tf = new TextField(20);
    tf.select(0, 10);
    bt = new Button("Disable textfield");
    p1.add(tf);
    p1.add(bt);
    mainFrame.add(p1);
    bt.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            tf.setEditable(false);
        }
    });
    mainFrame.setVisible(true);
}
 
Example 3
Source File: AltGraphModifierTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void initTestWindow() {
    mainFrame = new Frame();
    mainFrame.setTitle("TestWindow");
    mainFrame.setBounds(700, 10, 300, 300);
    mainFrame.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            int ex = e.getModifiersEx();
            if ((ex & InputEvent.ALT_GRAPH_DOWN_MASK) == 0) {
                AltGraphModifierTest.fail("Alt-Gr Modifier bit is not set.");
            } else {
                AltGraphModifierTest.pass();
            }
        }
    });
    mainFrame.setVisible(true);
}
 
Example 4
Source File: MultiResolutionDrawImageWithTransformTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void show(String title) {
    Frame frame = new Frame() {

        @Override
        public void paint(Graphics g) {
            super.paint(g);
            g.drawImage(buffImage, 0, 0, this);
            g.setColor(Color.GRAY);
            g.drawRect(0, 0, width, height);
            g.drawRect(0, height / 2, width, height / 2);
            g.drawRect(width / 2, 0, width / 2, height);
        }
    };
    frame.setTitle(title);
    frame.setSize(width, height);
    frame.setVisible(true);
}
 
Example 5
Source File: MultiResolutionDrawImageWithTransformTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void show(String title) {
    Frame frame = new Frame() {

        @Override
        public void paint(Graphics g) {
            super.paint(g);
            g.drawImage(buffImage, 0, 0, this);
            g.setColor(Color.GRAY);
            g.drawRect(0, 0, width, height);
            g.drawRect(0, height / 2, width, height / 2);
            g.drawRect(width / 2, 0, width / 2, height);
        }
    };
    frame.setTitle(title);
    frame.setSize(width, height);
    frame.setVisible(true);
}
 
Example 6
Source File: FrameDemo2.java    From Java with Artistic License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// ��������
	Frame f = new Frame();

	// ��������
	f.setTitle("����ر�");
	f.setSize(400, 200);
	f.setLocation(500, 250);

	// ע���¼�
	f.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});

	// ���ô���ɼ�
	f.setVisible(true);
}
 
Example 7
Source File: FrameDemo.java    From Java with Artistic License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// �����������
	Frame f = new Frame();

	// ����
	f.setTitle("�ٶ�һ��,���֪��");
	// ���ô����С
	f.setSize(400, 300);
	// ���ô���ɼ�
	f.setVisible(true);

	// �����
	f.setLocation(500, 200);

	// f.show();
	// System.out.println("over");
}
 
Example 8
Source File: MissingEventsOnModalDialogTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 9
Source File: MissingEventsOnModalDialogTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 10
Source File: MissingEventsOnModalDialogTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 11
Source File: MissingEventsOnModalDialogTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 12
Source File: MissingEventsOnModalDialogTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 13
Source File: MissingEventsOnModalDialogTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 14
Source File: MissingEventsOnModalDialogTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 15
Source File: MissingEventsOnModalDialogTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Frame createFrame(String title, int x, int y) {
    Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocation(x, y);
    frame.setTitle(title);
    frame.setVisible(true);
    return frame;
}
 
Example 16
Source File: ExtendedModifiersTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void createGUI() {

        frame = new Frame();
        frame.setTitle("ExtendedModifiersTest");
        frame.setLayout(new GridLayout(1, 6));

        button = new Button();
        button.addKeyListener(this);
        frame.add(button);

        buttonLW = new LWButton();
        buttonLW.addKeyListener(this);
        frame.add(buttonLW);

        textField = new TextField(5);
        textField.addKeyListener(this);
        frame.add(textField);

        textArea = new TextArea(5, 5);
        textArea.addKeyListener(this);
        frame.add(textArea);

        list = new List();
        for (int i = 1; i <= 5; ++i) {
            list.add("item " + i);
        }
        list.addKeyListener(this);
        frame.add(list);

        listLW = new LWList();
        for (int i = 1; i <= 5; ++i) {
            listLW.add("item " + i);
        }
        listLW.addKeyListener(this);
        frame.add(listLW);

        frame.setBackground(Color.gray);
        frame.setSize(500, 100);
        frame.setVisible(true);
        frame.toFront();
    }