Java Code Examples for javax.swing.JFrame#setAlwaysOnTop()
The following examples show how to use
javax.swing.JFrame#setAlwaysOnTop() .
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: RobotUtils.java From karate with MIT License | 6 votes |
public static void highlight(int x, int y, int width, int height, int time) { JFrame f = new JFrame(); f.setUndecorated(true); f.setBackground(new Color(0, 0, 0, 0)); f.setAlwaysOnTop(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setType(JFrame.Type.UTILITY); f.setFocusableWindowState(false); f.setAutoRequestFocus(false); f.setLocation(x, y); f.setSize(width, height); f.getRootPane().setBorder(BorderFactory.createLineBorder(Color.RED, 3)); f.setVisible(true); delay(time); f.dispose(); }
Example 2
Source File: JComboBoxPopupLocation.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void setup(final Point tmp) { comboBox = new JComboBox<>(); for (int i = 1; i < 7; i++) { comboBox.addItem("Long-long-long-long-long text in the item-" + i); } String property = System.getProperty(PROPERTY_NAME); comboBox.putClientProperty(PROPERTY_NAME, Boolean.valueOf(property)); frame = new JFrame(); frame.setAlwaysOnTop(true); frame.setLayout(new FlowLayout()); frame.add(comboBox); frame.pack(); frame.setSize(frame.getWidth(), SIZE); frame.setVisible(true); frame.setLocation(tmp.x, tmp.y); }
Example 3
Source File: GameShop.java From JAVA-MVC-Swing-Monopoly with Apache License 2.0 | 6 votes |
private void createWindow() { frame = new JFrame(); panel = new JPanel(); JLabel label = new JLabel("����"); panel.add(label); frame.add(new Background(0, 0, 0, 0, null,null)); frame.setSize(300, 300); // ���ô������롣 frame.setLocation( this.mainFrame.getX() + ((this.mainFrame.getWidth() + this.frame.getWidth()) / 2), this.mainFrame.getY() + ((this.mainFrame.getHeight() + this.frame.getHeight()) / 2)); frame.setUndecorated(true); frame.setAlwaysOnTop(true); frame.addMouseMotionListener(this); frame.addMouseListener(this); frame.setVisible(true); }
Example 4
Source File: PreferencesWin.java From SikuliX1 with MIT License | 5 votes |
private void btnMoreActionPerformed(ActionEvent e) { winPrefMore = new JFrame("Preferences: more Options ..."); Container mpwinCP = winPrefMore.getContentPane(); mpwinCP.setLayout(new BorderLayout()); mpwinCP.add(new PreferencesWindowMore(), BorderLayout.CENTER); winPrefMore.pack(); winPrefMore.setAlwaysOnTop(true); winPrefMore.setDefaultCloseOperation(DISPOSE_ON_CLOSE); winPrefMore.setLocation(getLocation().x - 70, getLocation().y); winPrefMore.setVisible(true); }
Example 5
Source File: Main.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void showInterfaceSelector(String[] interfaceNames) { _selectInterfaceWindow = new JDialog(_frame); _selectInterfaceWindow.setTitle("Double-Click to Select the Interface"); _selectInterfaceWindow.setLocationRelativeTo(_frame); _interfaceList = new JList<String>(interfaceNames); _interfaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scrollPane = new JScrollPane(_interfaceList); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = _interfaceList.locationToIndex(e.getPoint()); if (Captor.getInstance().getCurrentDeviceId() == index) { _selectInterfaceWindow.dispose(); return; } Captor.getInstance().openDevice(index); PacketSamurai.setConfigProperty("NetworkInterface", Integer.toString(index)); _selectInterfaceWindow.dispose(); } } }; _interfaceList.addMouseListener(mouseListener); _selectInterfaceWindow.add(scrollPane); _selectInterfaceWindow.setSize(400, 350); _selectInterfaceWindow.setVisible(true); JFrame frame = new JFrame("Title"); frame.setSize(200,200); frame.setAlwaysOnTop(true); frame.setVisible(true); }
Example 6
Source File: MouseModifiersInKeyEvent.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void createAndShowGUI() { f = new JFrame(); final Component component = new JTextField(); component.addKeyListener(new MyKeyListener()); f.add(component); f.setSize(300, 300); f.setLocationRelativeTo(null); f.setAlwaysOnTop(true); f.setVisible(true); }
Example 7
Source File: SysHotKey.java From xnx3 with Apache License 2.0 | 5 votes |
public static void main(String[] args) { SysHotKey key = new SysHotKey(); key.initHotkey(); frame = new JFrame(); frame.getContentPane().add(new JLabel("Just a test.")); frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE); Dimension di = Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize(di.width/4 , di.height/4); frame.setVisible(true); frame.setAlwaysOnTop(true); }
Example 8
Source File: SettingsWindow.java From tmc-intellij with MIT License | 5 votes |
public SettingsWindow() { logger.info("Building SettingsWindow. @SettingsWindow"); frame = new JFrame(); JPanel panel = new SettingsPanel(frame).getPanel(); frame.add(panel); frame.setTitle("TMC Settings"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setResizable(true); frame.setSize(new Dimension(800, 500)); frame.setAlwaysOnTop(true); }
Example 9
Source File: MarqueeBanner.java From mars-sim with GNU General Public License v3.0 | 5 votes |
void display() { JFrame f = new JFrame("MarqueeTest"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String s = "Tomorrow, and tomorrow, and tomorrow, " + "creeps in this petty pace from day to day, " + "to the last syllable of recorded time; ... " + "It is a tale told by an idiot, full of " + "sound and fury signifying nothing."; MarqueePanel mp = new MarqueePanel(s, 52); f.add(mp); f.pack(); f.setLocationRelativeTo(desktop); f.setVisible(true); f.setAlwaysOnTop(true); mp.start(); }
Example 10
Source File: AhkFastTyper.java From training with MIT License | 5 votes |
private static void makeUI() { frame = new JFrame("Keyboard Shortcuts Pane"); frame.setUndecorated(true); frame.setBackground(new Color(1, 1, 1, 0f)); // frame.setFocusableWindowState(false); frame.setSize(100, 30); frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setFocusableWindowState(false); frame.setFocusable(true); frame.setVisible(false); }
Example 11
Source File: MaskApplicationMain.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private static JFrame createFrame(String name, JPanel panel) { final JFrame frame = new JFrame(name); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setAlwaysOnTop(true); frame.pack(); return frame; }
Example 12
Source File: VirtualCursor.java From haxademic with MIT License | 5 votes |
public void setup() { super.setup(); // set special window properties jframe = (JFrame)((PSurfaceAWT.SmoothCanvas) getSurface().getNative()).getFrame(); jframe.removeNotify(); jframe.setUndecorated(true); jframe.setLayout(null); jframe.addNotify(); jframe.setAlwaysOnTop(true); pg = createGraphics(width, height); cursor = Base64Image.decodePImageFromBase64("iVBORw0KGgoAAAANSUhEUgAAAGoAAAC1CAMAAACAl5pfAAAAYFBMVEVHcEyRkZEQEBAAAAB1dXVISEgmJib///8cHBwGBgYoKCj9/f3////T09O8vLzl5eX19fVubm4yMjJCQkJXV1eJiYmhoaEvLy+YmJjY2Ng6Ojqurq7Hx8f19fXo6OheXl4dpwGJAAAAIHRSTlMAbe//ibfYBOP5//7/7u3x9vP9+fbv7s/kJcVRNwoVoJWYs8AAAAPzSURBVHgBvM2FiURRAASw+679t3uGDSwamJcG8jXUNC/LvI6YtuXfftSnaVlGXecy7LqWvPpVXv0qr36VV7vKq1/l1a7yald5tau82lVe7SqvdpVXuypcUd3P3b2iettXVO0rq/KVVfnKqnxlVb6yKl9Zla+syldW5Sur8pVV+cqqfGVVvrIqX58VX17xBRVfUNkFFVxQwQUVXFDBpRVcWsGlFVxawcWVX1755ZVfXvkFFV9Q8QUVX1DxBRVfUPEFFV9Q8QUVX1DRBRVcUMEFFVxQwQUVXFDBBRVfUPEFFV9Q8QUVX1DxBRVfUPEFFV9Q8QUVX1DxBRVfUPEFFV9Q8QUVX1DxBRVfUPEFFV9Q8QUVX1DxBRVfUPEFFV9Q8WWVX1799HIeWo6DMBTF3cBx7/3/v3L7xsqGvMXImXd62gWPuLKmZXmWFUVZam1kBc8sBqpSj3Urkrpu2raquq6Xryw3VPsA4VAWf+y2zOCIGoPr8dxQlQMqdUPl6jrKByiUL0S111GRI6q8vq3pvyiddxm+gvMQx2nq+1LK9yC5gGI/z6pSGSqMVTxl26d1WRbPC8PjiKL550riY0e2oFZQJdjWLOyCUdXfD6xNT/3NdgOqO5WKthXyUT352rcvz9bkxHBRVAmGhRTn0wsTlVFSoHpwBWMGiiza6vpO11FAB6oA24rcUdrQ+2ogQplcRwFzK9SLQ2eUMqGqf0mk3lNXFCWhbWVUhE6ompKiE5XzREhQZpJITxYwV7BfQRESXawXWInwuI5qKGmgrzCJsDnr/TKqVS+32sf7K6jJSfcuoipKSn83ot1OhOk1VEdJ/t+WN4Bt5UiEANU/kR41tTiKEKBySpJkkT4QIbmn3qxR4zuSCM9taYYIZUBjFs0WPFIxGr8EpEciTuMHKMN7pvci1KQwBmsUOI1IhKOtCKUFiSdCgArxyxrU+O1QeGV8EVIUPPNEhJ2rCKUFCYgQTEAAhct1PVEZbvwQhe6IsQjxBARQaQJQSIR4AjKgfKjmRHInIJ82KBS+CA/SNnAm7gS0+YSEE3MnoP3XJ6SAdGPjX8NwFTbx7USYCGawCOnsFzIQQISg3nmZGRMQCEOEw71/nl3jCYgf68bPT8KcgHDsRQgaP4iLCDVo/CBuIgQTEIiLCDUUoUP4ExCOXePXmi9C/gT0UREu94ow/zoRKnAFPytC3SoV3CNCPAFlNeHgW2Ve4+/Ihnhywo2/bAiIJww8AeVPHND2mSLsKhOI6oIvQpx0ETclxKB5FbdlAxx57OLORO9AsSduzmTeUAS6L1uEJH6YfPDfEJEMi/hQEskvBYd6T28tBWCnaBUfT+j/LIVNWOY7PppBCtOtd0oAAAAASUVORK5CYII="); JPanel panel = new JPanel() { private static final long serialVersionUID = 1L; @Override protected void paintComponent(Graphics graphics) { if (graphics instanceof Graphics2D) { Graphics2D g2d = (Graphics2D) graphics; g2d.drawImage(pg.image, 0, 0, null); } } }; jframe.setContentPane(panel); panel.setFocusable(true); panel.setFocusTraversalKeysEnabled(false); panel.requestFocus(); panel.requestFocusInWindow(); }
Example 13
Source File: VirtualCursor.java From haxademic with MIT License | 5 votes |
public void setup() { super.setup(); fxPanel = new JFXPanel(); jframe = (JFrame)((PSurfaceAWT.SmoothCanvas) getSurface().getNative()).getFrame(); jframe.removeNotify(); jframe.setUndecorated(true); jframe.setLayout(null); jframe.addNotify(); jframe.setAlwaysOnTop(true); jframe.add(fxPanel); jframe.setSize(750, 900); jframe.setVisible(true); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); // set special window properties jframe.setContentPane(fxPanel); fxPanel.setFocusable(false); fxPanel.setFocusTraversalKeysEnabled(false); fxPanel.requestFocus(); fxPanel.requestFocusInWindow(); }
Example 14
Source File: CounterDisplay.java From ApprovalTests.Java with Apache License 2.0 | 5 votes |
public static void main(String[] args) { String pass = (0 < args.length) ? args[0] : "counter_pass.txt"; String fail = (1 < args.length) ? args[1] : "counter_fail.txt"; JFrame window = new JFrame("Testing Frame"); window.setAlwaysOnTop(true); window.getContentPane().add(new CounterDisplay(pass, fail)); WindowUtils.testFrame(window, true); }
Example 15
Source File: Boot.java From MakeLobbiesGreatAgain with MIT License | 4 votes |
public static void getLocalAddr() throws InterruptedException, PcapNativeException, UnknownHostException, SocketException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { if (Settings.getDouble("autoload", 0) == 1) { addr = InetAddress.getByName(Settings.get("addr", "")); return; } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final JFrame frame = new JFrame("Network Device"); frame.setFocusableWindowState(true); final JLabel ipLab = new JLabel("Select LAN IP obtained from Network Settings:", JLabel.LEFT); final JComboBox<String> lanIP = new JComboBox<String>(); final JLabel lanLabel = new JLabel("If your device IP isn't in the dropdown, provide it below."); final JTextField lanText = new JTextField(Settings.get("addr", "")); ArrayList<InetAddress> inets = new ArrayList<InetAddress>(); for (PcapNetworkInterface i : Pcaps.findAllDevs()) { for (PcapAddress x : i.getAddresses()) { InetAddress xAddr = x.getAddress(); if (xAddr != null && x.getNetmask() != null && !xAddr.toString().equals("/0.0.0.0")) { NetworkInterface inf = NetworkInterface.getByInetAddress(x.getAddress()); if (inf != null && inf.isUp() && !inf.isVirtual()) { inets.add(xAddr); lanIP.addItem((lanIP.getItemCount() + 1) + " - " + inf.getDisplayName() + " ::: " + xAddr.getHostAddress()); System.out.println("Found: " + lanIP.getItemCount() + " - " + inf.getDisplayName() + " ::: " + xAddr.getHostAddress()); } } } } if (lanIP.getItemCount() == 0) { JOptionPane.showMessageDialog(null, "Unable to locate devices.\nPlease try running the program in Admin Mode.\nIf this does not work, you may need to reboot your computer.", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } lanIP.setFocusable(false); final JButton start = new JButton("Start"); start.addActionListener(e -> { try { if (lanText.getText().length() >= 7 && !lanText.getText().equals("0.0.0.0")) { // 7 is because the minimum field is 0.0.0.0 addr = InetAddress.getByName(lanText.getText()); System.out.println("Using IP from textfield: " + lanText.getText()); } else { addr = inets.get(lanIP.getSelectedIndex()); System.out.println("Using device from dropdown: " + lanIP.getSelectedItem()); } Settings.set("addr", addr.getHostAddress().replaceAll("/", "")); frame.setVisible(false); frame.dispose(); } catch (UnknownHostException e1) { e1.printStackTrace(); } }); frame.setLayout(new GridLayout(5, 1)); frame.add(ipLab); frame.add(lanIP); frame.add(lanLabel); frame.add(lanText); frame.add(start); frame.setAlwaysOnTop(true); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); while (frame.isVisible()) Thread.sleep(10); }
Example 16
Source File: Solver.java From algorithms-nutshell-2ed with MIT License | 4 votes |
public static void main(String[] args) throws Exception { // solution found. Create GUI. final JFrame frame = new JFrame(); frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { /** Once opened: load up the images. */ public void windowOpened(WindowEvent e) { System.out.println("Loading card images..."); cardImages = CardImagesLoader.getDeck(e.getWindow()); } }); frame.setSize(808,350); JList<IMove> list = new JList<IMove>(); // add widgets at proper location frame.setLayout(null); // top row: JPanel topLeft = new JPanel(); topLeft.setBounds(0, 0, 400, 40); topLeft.add(new JLabel("Select Game:")); final JTextField jtf = new JTextField (7); topLeft.add(jtf); frame.add(topLeft); JPanel topRight = new JPanel(); topRight.setBounds(400, 0, 400, 40); String instructions = "Select moves from below list to see game state at that moment."; topRight.add(new JLabel(instructions)); frame.add(topRight); // bottom row FreeCellDrawing drawer = new FreeCellDrawing(); drawer.setBounds (0, 40, 400, 275); drawer.setBackground(new java.awt.Color (0,128,0)); frame.add(drawer); // Create the GUI and put it in the window with scrollbars. JScrollPane scrollingPane = new JScrollPane(list); scrollingPane.setAutoscrolls(true); scrollingPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollingPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollingPane.setBounds(400, 40, 400, 275); frame.add(scrollingPane); // set up listeners and show everything jtf.addActionListener(new DealController(frame, drawer, list)); frame.setVisible(true); }