List of usage examples for java.awt BorderLayout NORTH
String NORTH
To view the source code for java.awt BorderLayout NORTH.
Click Source Link
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.out.println(e.toString()); }/* w w w . j av a2 s . c om*/ }); list.setSelectionModel(m); ListSelectionListener[] lis = m.getListSelectionListeners(); add(pane, BorderLayout.NORTH); }
From source file:Main.java
public Main() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel jl = new JLabel("Try with formatted text field "); Locale local1 = new Locale("en", "US"); int minFra = 0; int maxFra = 3; jft = setFormat(jft, local1, minFra, maxFra); jft.setMaximumSize(new Dimension(100, 20)); jft.setMinimumSize(new Dimension(100, 20)); jft.setPreferredSize(new Dimension(100, 20)); frame.add(jl);/*from w ww . jav a 2 s . co m*/ frame.add(jft, BorderLayout.NORTH); jb.addActionListener(e -> JOptionPane.showMessageDialog(jb, "nel text Box : " + jft.getText())); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.out.println(e.toString()); }/*w ww. j a v a 2 s . c o m*/ }); list.setSelectionModel(m); System.out.println(m.getValueIsAdjusting()); add(pane, BorderLayout.NORTH); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); m.setLeadAnchorNotificationEnabled(false); list.setSelectionModel(m);/* w w w . ja va 2 s .c om*/ try { DefaultListSelectionModel mClone = (DefaultListSelectionModel) m.clone(); } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } add(pane, BorderLayout.NORTH); }
From source file:WebBrowserBasedOnJEditorPane.java
public WebBrowserBasedOnJEditorPane() { setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel pnlURL = new JPanel(); pnlURL.setLayout(new BorderLayout()); pnlURL.add(new JLabel("URL: "), BorderLayout.WEST); pnlURL.add(txtURL, BorderLayout.CENTER); getContentPane().add(pnlURL, BorderLayout.NORTH); getContentPane().add(ep, BorderLayout.CENTER); getContentPane().add(lblStatus, BorderLayout.SOUTH); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ae) { try { String url = ae.getActionCommand().toLowerCase(); if (url.startsWith("http://")) url = url.substring(7); ep.setPage("http://" + IDN.toASCII(url)); } catch (Exception e) { e.printStackTrace();/*from ww w.j a v a2s .co m*/ JOptionPane.showMessageDialog(WebBrowserBasedOnJEditorPane.this, "Browser problem: " + e.getMessage()); } } }; txtURL.addActionListener(al); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.out.println(e.toString()); }//from w ww .ja va 2s .c o m }); list.setSelectionModel(m); ListSelectionListener[] lsls = (ListSelectionListener[]) (m.getListeners(ListSelectionListener.class)); add(pane, BorderLayout.NORTH); }
From source file:DropTest.java
public DropTest() { super("Drop Test"); setSize(300, 300);//from www . j a va 2 s . c om getContentPane().add(new JLabel("Drop a list from your file chooser here:"), BorderLayout.NORTH); ta = new JTextArea(); ta.setBackground(Color.white); getContentPane().add(ta, BorderLayout.CENTER); // Set up our text area to recieve drops... // This class will handle drop events dt = new DropTarget(ta, this); setVisible(true); }
From source file:NewDropTest.java
public NewDropTest() { super("Drop Test"); setSize(300, 300);//w w w . j a va 2 s . co m getContentPane().add(new JLabel("Drop a list from your file chooser here:"), BorderLayout.NORTH); ta = new JTextArea(); ta.setBackground(Color.white); getContentPane().add(ta, BorderLayout.CENTER); // Set up our text area to recieve drops... // This class will handle drop events // dt = new DropTarget(ta, this); setVisible(true); }
From source file:Main.java
public Main() { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/HTML"); editorPane.setEditorKit(new HTMLEditorKit()); editorPane.setText("<hr>Welcome to <b>java2s.com!</b><hr>"); JToolBar bar = new JToolBar(); bar.add(new StyledEditorKit.ForegroundAction("Red", Color.red)); bar.add(new StyledEditorKit.ForegroundAction("Blue", Color.blue)); bar.add(new StyledEditorKit.FontSizeAction("12", 12)); bar.add(new StyledEditorKit.FontSizeAction("14", 14)); bar.add(new StyledEditorKit.FontSizeAction("16", 16)); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.add(bar, BorderLayout.NORTH); this.add(editorPane, BorderLayout.CENTER); this.pack();//from ww w .ja v a 2 s . co m this.setVisible(true); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.out.println(e.toString()); }//from w w w . ja va 2 s. c o m }); list.setSelectionModel(m); System.out.println(m.getSelectionMode() == ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); add(pane, BorderLayout.NORTH); }