Java Code Examples for java.awt.Frame

The following are top voted examples for showing how to use java.awt.Frame. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: XWM.java   View source code 6 votes vote down vote up
/**
 * Check if state is supported.
 * Note that a compound state is always reported as not supported.
 * Note also that MAXIMIZED_BOTH is considered not a compound state.
 * Therefore, a compound state is just ICONIFIED | anything else.
 *
 */
boolean supportsExtendedState(int state) {
    switch (state) {
      case Frame.MAXIMIZED_VERT:
      case Frame.MAXIMIZED_HORIZ:
          /*
           * WMs that talk NET/WIN protocol, but do not support
           * unidirectional maximization.
           */
          if (getWMID() == METACITY_WM) {
              /* "This is a deliberate policy decision." -hp */
              return false;
          }
          /* FALLTROUGH */
      case Frame.MAXIMIZED_BOTH:
          for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
              if (proto.supportsState(state)) {
                  return true;
              }
          }
      default:
          return false;
    }
}
 
Example 2
Project: sbc-qsystem   File: FTimedDialog.java   View source code 6 votes vote down vote up
/**
 * Статический метод который показывает модально диалог регистрации клиентов.
 *
 * @param parent фрейм относительно которого будет модальность
 * @param modal модальный диалог или нет
 */
public static void showTimedDialog(Frame parent, boolean modal, String message, int timeout) {
    if (dialog == null) {
        dialog = new FTimedDialog(parent, modal);
        dialog.setTitle("Сообщение.");
    }
    dialog.setBounds(10, 10, 1024, 400);
    dialog.changeTextToLocale();
    dialog.labelMess.setText(message);
    Uses.setLocation(dialog);
    dialog.clockClose = new ATalkingClock(timeout, 1) {

        @Override
        public void run() {
            dialog.buttonCloseActionPerformed(null);
        }
    };
    dialog.clockClose.start();
    dialog.setVisible(true);
}
 
Example 3
Project: jdk8u-jdk   File: RemoveHelpMenu.java   View source code 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame("RemoveHelpMenu Test");
    try {
        frame.pack();
        // peer exists
        test1(getMenuBar(frame));
        test2(getMenuBar(frame));
        test3(getMenuBar(frame));
        test4(getMenuBar(frame));
    } finally {
        frame.dispose();
    }
    // peer is null
    test1(getMenuBar(frame));
    test2(getMenuBar(frame));
    test3(getMenuBar(frame));
    test4(getMenuBar(frame));
}
 
Example 4
Project: ThingML-Tradfri   File: BulbPanel.java   View source code 6 votes vote down vote up
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    
    try {
        //JOptionPane pane = new JOptionPane();
        //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
        JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false);
        JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n");
        msg.setFont(new Font("monospaced", Font.PLAIN, 10));
        msg.setLineWrap(true);
        msg.setWrapStyleWord(true);
        JScrollPane scrollPane = new JScrollPane(msg);
        
        dialog.getContentPane().add(scrollPane);
        dialog.setSize(350, 350);
        //dialog.pack();
        dialog.setVisible(true);
        
        
    } catch (JSONException ex) {
        Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example 5
Project: openjdk-jdk10   File: FrameMinimizeTest.java   View source code 6 votes vote down vote up
public static void main(String args[]) throws Exception {
    Frame frame = new Frame("Frame Minimize Test");
    Button b = new Button("Focus ownder");
    frame.add("South", b);
    frame.pack();
    frame.setVisible(true);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after showing :(");
    }
    frame.setExtendedState(Frame.ICONIFIED);
    Util.waitForIdle(null);
    frame.setExtendedState(Frame.NORMAL);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after restoring :(");
    }
}
 
Example 6
Project: jdk8u-jdk   File: KeyCharTest.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();

        Frame frame = new Frame();
        frame.setSize(300, 300);
        frame.setVisible(true);
        toolkit.realSync();

        Robot robot = new Robot();

        robot.keyPress(KeyEvent.VK_DELETE);
        robot.keyRelease(KeyEvent.VK_DELETE);
        toolkit.realSync();

        frame.dispose();

        if (eventsCount != 3) {
            throw new RuntimeException("Wrong number of key events: " + eventsCount);
        }
    }
 
Example 7
Project: ants   File: SimpleGUI.java   View source code 6 votes vote down vote up
@Override
public void createMenu(final InitMenuData data) {
	if (this.frame != null) {
		try {
			SwingUtilities.invokeAndWait(new Runnable() {
				public void run() {
					frame.dispose();
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		}
		this.canvas = null;
		this.scoreboard = null;
		this.frame = null;
	}

	// Create and set up the window.
	this.frame = new JFrame("IBM Slovakia / Fall Fest 2017 / Anthill");
	this.frame.setExtendedState(this.frame.getExtendedState() | Frame.MAXIMIZED_BOTH);
	this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.frame.setLayout(new BorderLayout());

	// Set up the content pane.
	this.frame.add(new Menu(data, this.listener, this.frame));

	// Display the window.
	this.frame.pack();
	this.frame.setVisible(true);
}
 
Example 8
Project: openjdk-jdk10   File: R2303044ListSelection.java   View source code 6 votes vote down vote up
public static void main(final String[] args) throws HeadlessException {
    final Frame frame = new Frame("Test Frame");
    final List list = new List();
    frame.setSize(300, 200);
    list.add(ITEM_NAME);
    list.select(0);
    frame.add(list);
    frame.validate();
    frame.setVisible(true);
    sleep();
    if (!ITEM_NAME.equals(list.getSelectedItem())) {
        throw new RuntimeException("List item not selected item.");
    }
    list.removeAll();
    frame.dispose();
}
 
Example 9
Project: jdk8u-jdk   File: XWM.java   View source code 6 votes vote down vote up
/**
 * Check if state is supported.
 * Note that a compound state is always reported as not supported.
 * Note also that MAXIMIZED_BOTH is considered not a compound state.
 * Therefore, a compound state is just ICONIFIED | anything else.
 *
 */
boolean supportsExtendedState(int state) {
    switch (state) {
      case Frame.MAXIMIZED_VERT:
      case Frame.MAXIMIZED_HORIZ:
          /*
           * WMs that talk NET/WIN protocol, but do not support
           * unidirectional maximization.
           */
          if (getWMID() == METACITY_WM) {
              /* "This is a deliberate policy decision." -hp */
              return false;
          }
          /* FALLTROUGH */
      case Frame.MAXIMIZED_BOTH:
          for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
              if (proto.supportsState(state)) {
                  return true;
              }
          }
      default:
          return false;
    }
}
 
Example 10
Project: Hotel-Properties-Management-System   File: ShowReport.java   View source code 6 votes vote down vote up
public void loadReport(String reportName, ReportObject reportObject) {

		logging = LoggingEngine.getInstance();
		
		try {
			
			final InputStream inputStream = ShowReport.class
					.getResourceAsStream("/com/coder/hms/reportTemplates/" + reportName + ".jrxml");
			JasperReport report = JasperCompileManager.compileReport(inputStream);

			HashMap<String, Object> parameters = new HashMap<String, Object>();	
			List<ReportObject> list = new ArrayList<ReportObject>();
			list.add(reportObject);
			JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list);
			JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, beanColDataSource);
			final JRViewer viewer = new JRViewer(jasperPrint);

			setType(Type.POPUP);
			setResizable(false);
			setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
			this.setTitle("Reservation [Report]");
			this.setExtendedState(Frame.MAXIMIZED_BOTH);
			this.setAlwaysOnTop(isAlwaysOnTopSupported());
			this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			getContentPane().setLayout(new BorderLayout());
			this.setIconImage(Toolkit.getDefaultToolkit().
					getImage(LoginWindow.class.getResource(LOGOPATH)));
			this.setResizable(false);
			getContentPane().add(viewer, BorderLayout.CENTER);

		} catch (JRException e) {
			logging.setMessage("JRException report error!");
		}

	}
 
Example 11
Project: jdk8u-jdk   File: XFramePeer.java   View source code 6 votes vote down vote up
void preInit(XCreateWindowParams params) {
    super.preInit(params);
    Frame target = (Frame)(this.target);
    // set the window attributes for this Frame
    winAttr.initialState = target.getExtendedState();
    state = 0;
    undecorated = Boolean.valueOf(target.isUndecorated());
    winAttr.nativeDecor = !target.isUndecorated();
    if (winAttr.nativeDecor) {
        winAttr.decorations = winAttr.AWT_DECOR_ALL;
    } else {
        winAttr.decorations = winAttr.AWT_DECOR_NONE;
    }
    winAttr.functions = MWMConstants.MWM_FUNC_ALL;
    winAttr.isResizable = true; // target.isResizable();
    winAttr.title = target.getTitle();
    winAttr.initialResizability = target.isResizable();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Frame''s initial attributes: decor {0}, resizable {1}, undecorated {2}, initial state {3}",
                 Integer.valueOf(winAttr.decorations), Boolean.valueOf(winAttr.initialResizability),
                 Boolean.valueOf(!winAttr.nativeDecor), Integer.valueOf(winAttr.initialState));
    }
}
 
Example 12
Project: openjdk-jdk10   File: TextAreaTwicePack.java   View source code 6 votes vote down vote up
public static void main(final String[] args) {
    final Frame frame = new Frame();
    final TextArea ta = new TextArea();
    frame.add(ta);
    frame.pack();
    frame.setVisible(true);
    sleep();
    final Dimension before = frame.getSize();
    frame.pack();
    final Dimension after = frame.getSize();
    if (!after.equals(before)) {
        throw new RuntimeException(
                "Expected size: " + before + ", actual size: " + after);
    }
    frame.dispose();
}
 
Example 13
Project: openjdk-jdk10   File: AltGraphModifierTest.java   View source code 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 14
Project: openjdk-jdk10   File: MultiResolutionSplashTest.java   View source code 6 votes vote down vote up
static void testFocus() throws Exception {

        Robot robot = new Robot();
        robot.setAutoDelay(50);

        Frame frame = new Frame();
        frame.setSize(100, 100);
        String test = "123";
        TextField textField = new TextField(test);
        textField.selectAll();
        frame.add(textField);
        frame.setVisible(true);
        robot.waitForIdle();

        robot.keyPress(KeyEvent.VK_A);
        robot.keyRelease(KeyEvent.VK_A);
        robot.keyPress(KeyEvent.VK_B);
        robot.keyRelease(KeyEvent.VK_B);
        robot.waitForIdle();

        frame.dispose();

        if (!textField.getText().equals("ab")) {
            throw new RuntimeException("Focus is lost!");
        }
    }
 
Example 15
Project: jdk8u-jdk   File: WindowsLeak.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Robot r = new Robot();
    for (int i = 0; i < 100; i++) {
        Frame f = new Frame();
        f.pack();
        f.dispose();
    }
    r.waitForIdle();

    Disposer.addRecord(new Object(), () -> disposerPhantomComplete = true);

    while (!disposerPhantomComplete) {
        Util.generateOOME();
    }

    Vector<WeakReference<Window>> windowList =
                    (Vector<WeakReference<Window>>) AppContext.getAppContext().get(Window.class);

    if (windowList != null && !windowList.isEmpty()) {
        throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.size());
    }

    System.out.println("Test PASSED");
}
 
Example 16
Project: myster   File: StandardWindowBehavior.java   View source code 6 votes vote down vote up
public void windowClosing(WindowEvent e) {
    e.getWindow().setVisible(false);
    e.getWindow().dispose();
    if ( !(e.getWindow() instanceof Frame))
        return;
    ((Frame)e.getWindow()).setMenuBar(null);
    ((Frame)e.getWindow()).removeAll();
}
 
Example 17
Project: OpenJSharp   File: XNETProtocol.java   View source code 6 votes vote down vote up
private void setInitialState(XWindowPeer window, int state) {
    XAtomList old_state = window.getNETWMState();
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Current state of the window {0} is {1}", window, old_state);
    }
    if ((state & Frame.MAXIMIZED_VERT) != 0) {
        old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT);
    } else {
        old_state.remove(XA_NET_WM_STATE_MAXIMIZED_VERT);
    }
    if ((state & Frame.MAXIMIZED_HORIZ) != 0) {
        old_state.add(XA_NET_WM_STATE_MAXIMIZED_HORZ);
    } else {
        old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ);
    }
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Setting initial state of the window {0} to {1}", window, old_state);
    }
    window.setNETWMState(old_state);
}
 
Example 18
Project: openjdk-jdk10   File: SetShapeTest.java   View source code 6 votes vote down vote up
private static void createUI() throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            background = new Frame();
            background.setUndecorated(true);
            background.setBackground(Color.blue);
            background.setSize(300, 300);
            background.setLocation(100, 100);
            background.setVisible(true);
            window = new Window(background);
            window.setBackground(Color.red);
            window.add(new Panel(), BorderLayout.CENTER);
            window.setLocation(200, 200);
            window.setSize(100, 100);
            Area a = new Area();
            a.add(new Area(new Rectangle2D.Double(0, 0, 100, 100)));
            window.setShape(a);
            window.setVisible(true);
            window.toFront();
        }
    });
}
 
Example 19
Project: openjdk-jdk10   File: JOptionPane.java   View source code 6 votes vote down vote up
private JDialog createDialog(Component parentComponent, String title,
        int style)
        throws HeadlessException {

    final JDialog dialog;

    Window window = JOptionPane.getWindowForComponent(parentComponent);
    if (window instanceof Frame) {
        dialog = new JDialog((Frame)window, title, true);
    } else {
        dialog = new JDialog((Dialog)window, title, true);
    }
    if (window instanceof SwingUtilities.SharedOwnerFrame) {
        WindowListener ownerShutdownListener =
                SwingUtilities.getSharedOwnerFrameShutdownListener();
        dialog.addWindowListener(ownerShutdownListener);
    }
    initDialog(dialog, style, parentComponent);
    return dialog;
}
 
Example 20
Project: incubator-netbeans   File: FileChooserBuilder.java   View source code 6 votes vote down vote up
private FileDialog createFileDialog( File currentDirectory ) {
    if( badger != null )
        return null;
    if( !Boolean.getBoolean("nb.native.filechooser") )
        return null;
    if( dirsOnly && !BaseUtilities.isMac() )
        return null;
    Component parentComponent = findDialogParent();
    Frame parentFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parentComponent);
    FileDialog fileDialog = new FileDialog(parentFrame);
    if (title != null) {
        fileDialog.setTitle(title);
    }
    if( null != currentDirectory )
        fileDialog.setDirectory(currentDirectory.getAbsolutePath());
    return fileDialog;
}
 
Example 21
Project: openjdk-jdk10   File: MaximizedUndecorated.java   View source code 6 votes vote down vote up
public static void main(String args[]) {
    if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
        return;
    }
    MaximizedUndecorated test = new MaximizedUndecorated();
    boolean doPass = true;
    try{
        if( !test.doTest(true) ) {
            System.out.println("Actual bounds differ from Maximum Window Bounds for JFrame");
            doPass = false;
        }
        if( !test.doTest(false) ) {
            System.out.println("Actual bounds differ from Maximum Window Bounds for Frame");
            doPass = false;
        }
    }catch(Exception ie) {
        ie.printStackTrace();
        throw new RuntimeException("Interrupted or InvocationTargetException occured");
    }
    if(!doPass) {
        throw new RuntimeException("Actual bounds of undecorated frame differ from Maximum Windows Bounds for this platform");
    }
}
 
Example 22
Project: sbc-qsystem   File: FServiceLangList.java   View source code 6 votes vote down vote up
public static void changeServiceLangList(Frame parent, boolean modal, final QService service) {
    QLog.l().logger().info("Редактирование языковых локаций \"" + service.getName() + "\"");
    if (serviceLangList == null) {
        serviceLangList = new FServiceLangList(parent, modal);
    }
    serviceLangList.setTitle(service.getName());
    serviceLangList.service = service;
    serviceLangList.listLng.setModel(new javax.swing.AbstractListModel() {

        @Override
        public int getSize() {
            return service.getLangs().size();
        }

        @Override
        public Object getElementAt(int i) {
            return service.getLangs().toArray()[i];
        }
    });
    Uses.setLocation(serviceLangList);
    serviceLangList.setVisible(true);
}
 
Example 23
Project: rapidminer   File: StopDialog.java   View source code 5 votes vote down vote up
public StopDialog(String title, String text) {
	super((Frame) null, title, false);
	getContentPane().setLayout(new BorderLayout());
	JLabel label = new JLabel(text);
	label.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
	getContentPane().add(label, BorderLayout.CENTER);

	Icon informationIcon = UIManager.getIcon("OptionPane.informationIcon");

	if (informationIcon != null) {
		JLabel informationIconLabel = new JLabel(informationIcon);
		informationIconLabel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
		getContentPane().add(informationIconLabel, BorderLayout.WEST);
	}

	JPanel buttonPanel = new JPanel();
	JButton stopButton = new JButton("Stop");
	stopButton.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			stillRunning = false;
		}
	});
	buttonPanel.add(stopButton);
	getContentPane().add(buttonPanel, BorderLayout.SOUTH);

	pack();
	setLocationRelativeTo(null);
}
 
Example 24
Project: sstore-soft   File: ZaurusConnectionDialog.java   View source code 5 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param owner
 * @param title
 */
public static Connection createConnection(Frame owner, String title,
        Insets defInsets) {

    ZaurusConnectionDialog dialog = new ZaurusConnectionDialog(owner,
        title);

    dialog.create(defInsets);

    return dialog.mConnection;
}
 
Example 25
Project: openjdk-jdk10   File: DefaultFrameDriver.java   View source code 5 votes vote down vote up
@Override
public void iconify(ComponentOperator oper) {
    checkSupported(oper);
    eDriver.dispatchEvent(oper.getSource(),
            new WindowEvent((Window) oper.getSource(),
                    WindowEvent.WINDOW_ICONIFIED));
    ((FrameOperator) oper).setState(Frame.ICONIFIED);
}
 
Example 26
Project: hml   File: FileChooserDialog.java   View source code 5 votes vote down vote up
public String saveFile(Frame f, String title, String defDir, String fileType) {
 FileDialog fd = new FileDialog(f, title, FileDialog.SAVE);
 fd.setFile(fileType);
 fd.setDirectory(defDir);
 fd.setLocation(50, 50);
 fd.show();
 return fd.getDirectory()+fd.getFile();
}
 
Example 27
Project: SER316-Dresden   File: SetAppDialog.java   View source code 5 votes vote down vote up
public SetAppDialog(Frame frame, String title) {
  super(frame, title, true);
  try {
    jbInit();
    pack();
  }
  catch(Exception ex) {
    new ExceptionDialog(ex);
  }
}
 
Example 28
Project: Neukoelln_SER316   File: TdDialog.java   View source code 5 votes vote down vote up
public TdDialog(Frame frame) {
  super(frame, Local.getString("Table properties"), true);
  try {
    jbInit();
    pack();
  }
  catch(Exception ex) {
    ex.printStackTrace();
  }
}
 
Example 29
Project: openvisualtraceroute   File: TraceRouteFrame.java   View source code 5 votes vote down vote up
public void close() {
	Env.INSTANCE.setFullScreen(getExtendedState() == Frame.MAXIMIZED_BOTH);
	if (_mainPanel != null) {
		_mainPanel.dispose();
	}
	LOGGER.info("Application exited.");
}
 
Example 30
Project: Dahlem_SER316   File: SrcDialog.java   View source code 5 votes vote down vote up
public SrcDialog(Frame frame, String text) {
	super(frame, "Source text", true);
	try {
		setText(text);
		jbInit();
		pack();
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
Example 31
Project: SER316-Aachen   File: StickerDialog.java   View source code 5 votes vote down vote up
public StickerDialog(Frame frame, String text, String backcolor, String forecolor, int sP, int size){
	super(frame, Local.getString("Sticker"), true);
	try {
		jbInit();
		pack();
	} catch (Exception ex) {
		new ExceptionDialog(ex);
	}
	stickerText.setText(text);
	Color back = Color.decode(backcolor);
	Color front = Color.decode(forecolor);
	int i = findColorIndex(back);
	if (i > -1)
		stickerColor.setSelectedIndex(i);
	else
		stickerColor.setSelectedIndex(10);
	i = findColorIndex(front);
	if (i > -1)
		textColor.setSelectedIndex(i);
	else
		textColor.setSelectedIndex(stickerColor.getSelectedIndex()+1);
	if (sP > -1 && sP < 5)
		priorityList.setSelectedIndex(sP);
	else
		priorityList.setSelectedIndex(2);
	if(size==10)
		fontSize.setSelectedIndex(0);
	else if(size == 20)
		fontSize.setSelectedIndex(2);
	else fontSize.setSelectedIndex(1);
}
 
Example 32
Project: Neukoelln_SER316   File: StickerDialog.java   View source code 5 votes vote down vote up
public StickerDialog(Frame frame) {
	super(frame, Local.getString("Sticker"), true);
	try {
		jbInit();
		pack();
	} catch (Exception ex) {
		new ExceptionDialog(ex);
	}
}
 
Example 33
Project: openjdk-jdk10   File: HoveringAndDraggingTest.java   View source code 5 votes vote down vote up
public void start() {
    String[] instructions = new String[] {
        "1. Notice components in test window: main-panel, box-for-text,"
            +" 2 scroll-sliders, and 4 scroll-buttons.",
        "2. Hover mouse over box-for-text."
            +" Make sure, that mouse cursor is TextCursor (a.k.a. \"beam\").",
        "3. Hover mouse over each of components (see item 1), except for box-for-text."
            +" Make sure, that cursor is DefaultCursor (arrow).",
        "4. Drag mouse (using any mouse button) from box-for-text to every"
            +" component in item 1, and also outside application window."
            +" Make sure, that cursor remains TextCursor while mouse button is pressed.",
        "5. Repeat item 4 for each other component in item 1, except for box-for-text,"
            +" _but_ now make sure that cursor is DefaultCursor.",
        "6. If cursor behaves as described in items 2-3-4-5, then test passed; otherwise it failed."
    };
    Sysout.createDialogWithInstructions( instructions );

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( new TextArea( bigString() ) );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
Example 34
Project: jdk8u-jdk   File: XFramePeer.java   View source code 5 votes vote down vote up
@Override
boolean isTargetUndecorated() {
    if (undecorated != null) {
        return undecorated.booleanValue();
    } else {
        return ((Frame)target).isUndecorated();
    }
}
 
Example 35
Project: Reinickendorf_SER316   File: ImageDialog.java   View source code 5 votes vote down vote up
public ImageDialog(Frame frame) {
    super(frame, Local.getString("Image"), true);
    try {
        jbInit();
        pack();
    }
    catch (Exception ex) {
        ex.printStackTrace();
    }
    super.addWindowListener(this);
}
 
Example 36
Project: SER316-Dresden   File: ExitConfirmationDialog.java   View source code 5 votes vote down vote up
public ExitConfirmationDialog(Frame frame, String title) {
   super(frame, title, true);
   try {
       jbInit();
       pack();
   }
   catch (Exception ex) {
       new ExceptionDialog(ex);
   }
   super.addWindowListener(this);
}
 
Example 37
Project: openjdk-jdk10   File: DitherTest.java   View source code 5 votes vote down vote up
public static void main(String args[]) {
    Frame f = new Frame("DitherTest");
    DitherTest ditherTest = new DitherTest();
    ditherTest.init();
    f.add("Center", ditherTest);
    f.pack();
    f.setVisible(true);
    ditherTest.start();
}
 
Example 38
Project: openjdk-jdk10   File: Test6991580.java   View source code 5 votes vote down vote up
public static void createDialog( )
{
  dialog = new TestDialog( new Frame(), "Instructions" );
  String[] defInstr = { "Instructions will appear here. ", "" } ;
  dialog.printInstructions( defInstr );
  dialog.show();
  println( "Any messages for the tester will display here." );
}
 
Example 39
Project: Dahlem_SER316   File: EditTypeDialog.java   View source code 5 votes vote down vote up
public EditTypeDialog(Frame frame, String title) {
    super(frame, title, true);
    try {
        jbInit();
        pack();
    }
    catch (Exception ex) {
        new ExceptionDialog(ex);
    }
}
 
Example 40
Project: sbc-qsystem   File: FStandAdvance.java   View source code 5 votes vote down vote up
/**
 * Статический метод который показывает модально диалог выбора времени для предварительной
 * записи клиентов.
 *
 * @param parent фрейм относительно которого будет модальность
 * @param modal модальный диалог или нет
 * @param netProperty свойства работы с сервером
 * @param fullscreen растягивать форму на весь экран и прятать мышку или нет
 * @param delay задержка перед скрытием диалога. если 0, то нет автозакрытия диалога
 * @return XML-описание результата предварительной записи, по сути это номерок. если null, то
 * отказались от предварительной записи
 */
public static RpcStandInService showAdvanceStandDialog(Frame parent, boolean modal,
    INetProperty netProperty, boolean fullscreen, int delay) {
    FStandAdvance.delay = delay;
    QLog.l().logger().info("Ввод кода предварительной записи");
    if (standAdvance == null) {
        standAdvance = new FStandAdvance(parent, modal);
        standAdvance.setTitle(getLocaleMessage("dialog.input_code"));
    }
    result = null;
    Uses.setLocation(standAdvance);
    FStandAdvance.netProperty = netProperty;
    if (!(QConfig.cfg().isDebug() || QConfig.cfg().isDemo() && !fullscreen)) {
        //Uses.setFullSize(standAdvance);
        if (QConfig.cfg().isHideCursor()) {
            int[] pixels = new int[16 * 16];
            Image image = Toolkit.getDefaultToolkit()
                .createImage(new MemoryImageSource(16, 16, pixels, 0, 16));
            Cursor transparentCursor = Toolkit.getDefaultToolkit()
                .createCustomCursor(image, new Point(0, 0), "invisibleCursor");
            standAdvance.setCursor(transparentCursor);
        }

    }
    standAdvance.changeTextToLocale();
    if (standAdvance.clockBack.isActive()) {
        standAdvance.clockBack.stop();
    }
    standAdvance.clockBack.start();
    standAdvance.setVisible(true);
    return result;
}