List of usage examples for java.awt Cursor getPredefinedCursor
public static Cursor getPredefinedCursor(int type)
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); aWindow.setVisible(true);//ww w .j a v a 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); aWindow.setVisible(true);//from w w w. j a v a 2s. co m }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); aWindow.setVisible(true);/*from ww w . j a v a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.CUSTOM_CURSOR)); aWindow.setVisible(true);//w w w. ja v a 2 s . c o m }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR)); aWindow.setVisible(true);//from w w w. j a v a 2s .c o m }
From source file:Main.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Cursor cursor = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR); System.out.println(cursor.toString()); aWindow.setVisible(true);//from www .j a va 2s .c o m }
From source file:MainClass.java
public static void main(String[] args) { JFrame aWindow = new JFrame(); aWindow.setBounds(200, 200, 200, 200); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); aWindow.getContentPane().setBackground(Color.PINK); aWindow.setVisible(true);/*from www.j av a 2s . c om*/ }
From source file:CreatingCursors.java
public static void main(String[] args) { JFrame aWindow = new JFrame("This is the Window Title"); Toolkit theKit = aWindow.getToolkit(); // Get the window toolkit Dimension wndSize = theKit.getScreenSize(); // Get screen size // Set the position to screen center & size to half screen size aWindow.setBounds(wndSize.width / 4, wndSize.height / 4, // Position wndSize.width / 2, wndSize.height / 2); // Size aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); aWindow.setVisible(true); // Display the window }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(new Dimension(500, 500)); JDialog dialog = new JDialog(frame, "Export", ModalityType.MODELESS); dialog.setSize(300, 300);/*from w ww .ja va2 s .c o m*/ JDialog dialog1 = new JDialog(dialog, "Export", ModalityType.APPLICATION_MODAL); dialog1.setSize(200, 200); frame.add(new JButton(new AbstractAction("Dialog") { @Override public void actionPerformed(ActionEvent e) { frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); dialog.setVisible(true); dialog1.setVisible(true); } })); frame.setVisible(true); }
From source file:Main.java
public static final void main(String[] args) throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextPane textPane = new JTextPane(); textPane.addMouseMotionListener(new MouseAdapter() { public void mouseMoved(MouseEvent e) { AttributeSet style = getAttributes(e); if (style != null && StyleConstants.getIcon(style) != null) { textPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { textPane.setCursor(Cursor.getDefaultCursor()); }// w w w . j a v a2s.c o m } }); frame.add(new JScrollPane(textPane)); StyledDocument doc = (StyledDocument) textPane.getDocument(); SimpleAttributeSet style = new SimpleAttributeSet(); StyleConstants.setIcon(style, createImage()); doc.insertString(doc.getLength(), "this is a test", null); doc.insertString(doc.getLength(), "test", style); doc.insertString(doc.getLength(), "this is a test\n", null); doc.insertString(doc.getLength(), "another image", style); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); }