List of usage examples for javax.swing JScrollPane setVerticalScrollBarPolicy
@BeanProperty(preferred = true, enumerationValues = { "ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED", "ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER", "ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS" }, description = "The scrollpane vertical scrollbar policy") public void setVerticalScrollBarPolicy(int policy)
From source file:Main.java
public static JComponent scrollH(JComponent content) { JScrollPane scroll = new JScrollPane(content); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); return scroll; }
From source file:Main.java
public static JComponent scrollV(JComponent content) { JScrollPane scroll = new JScrollPane(content); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); return scroll; }
From source file:Main.java
public static JComponent scrollV(String title, JComponent content) { JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createTitledBorder(title)); JScrollPane scroll = new JScrollPane(content); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); p.add(scroll);//from w w w.jav a 2 s. c om return p; }
From source file:eu.delving.sip.frames.AllFrames.java
public static JComponent miniScrollV(String title, JComponent content) { JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createTitledBorder(title)); JScrollPane scroll = new JScrollPane(content); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scroll.setPreferredSize(new Dimension(200, 80)); p.add(scroll);/* w ww. j a v a2s . c o m*/ return p; }
From source file:Main.java
public Main() { setLayout(new GridLayout(1, 2)); String[] numbers = { "one", "two", "three", "four", "five", "six", "seven" }; JList<String> list = new JList<>(numbers); list.setVisibleRowCount(1);//from w w w . j a v a2s . co m list.addListSelectionListener(this); JScrollPane s = new JScrollPane(list); s.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); s.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); add(s); list.setSelectedIndex(3); }
From source file:Main.java
private void loadLabel() { label.setBounds(0, 0, 269, 20);// ww w . j a v a 2 s . co m panel.add(label); input.setBounds(0, 20, 300, 60); JScrollPane scroll = new JScrollPane(input); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scroll.setVisible(true); scroll.setBounds(50, 20, 300, 60); panel.add(scroll); }
From source file:TextEditor.java
private void createTextArea() { textArea = new JTextArea("some text"); textArea.setLineWrap(true);/*w w w . j ava 2 s . c om*/ textArea.setWrapStyleWord(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(450, 250)); add(areaScrollPane); }
From source file:events.MouseEventDemo.java
public MouseEventDemo() { super(new GridLayout(0, 1)); blankArea = new BlankArea(Color.YELLOW); add(blankArea);//from ww w .j av a 2 s . c o m textArea = new JTextArea(); textArea.setEditable(false); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(200, 75)); add(scrollPane); //Register for mouse events on blankArea and the panel. blankArea.addMouseListener(this); addMouseListener(this); setPreferredSize(new Dimension(450, 450)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:MouseEventDemo.java
public MouseEventDemo() { super(new GridBagLayout()); GridBagLayout gridbag = (GridBagLayout) getLayout(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0;// w w w.j av a2s .c o m c.weighty = 1.0; c.insets = new Insets(1, 1, 1, 1); blankArea = new BlankArea(new Color(0.98f, 0.97f, 0.85f)); gridbag.setConstraints(blankArea, c); add(blankArea); c.insets = new Insets(0, 0, 0, 0); textArea = new JTextArea(); textArea.setEditable(false); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(200, 75)); gridbag.setConstraints(scrollPane, c); add(scrollPane); //Register for mouse events on blankArea and the panel. blankArea.addMouseListener(this); addMouseListener(this); setPreferredSize(new Dimension(450, 450)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:events.TreeExpandEventDemo.java
public TreeExpandEventDemo() { super(new GridBagLayout()); GridBagLayout gridbag = (GridBagLayout) getLayout(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0;//from w w w .j a v a 2 s . c o m c.weighty = 1.0; c.insets = new Insets(1, 1, 1, 1); demoArea = new DemoArea(); gridbag.setConstraints(demoArea, c); add(demoArea); c.insets = new Insets(0, 0, 0, 0); textArea = new JTextArea(); textArea.setEditable(false); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(200, 75)); gridbag.setConstraints(scrollPane, c); add(scrollPane); setPreferredSize(new Dimension(450, 450)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }