Java Code Examples for javax.swing.JScrollPane#setVerticalScrollBarPolicy()

The following examples show how to use javax.swing.JScrollPane#setVerticalScrollBarPolicy() . 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: LasInfoView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel3()
{
   JPanel jpanel1 = new JPanel();
   TitledBorder titledborder1 = new TitledBorder(null,"Header Information",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   jpanel1.setBorder(titledborder1);
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:GROW(1.0)");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _headerTable.setName("headerTable");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_headerTable);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xy(1,1));

   addFillComponents(jpanel1,new int[0],new int[0]);
   return jpanel1;
}
 
Example 2
Source File: TextAreaPage.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
private void create() {
  setLayout(new BorderLayout());

  JPanel middlePanel = new JPanel();
  middlePanel.setBorder(new TitledBorder(new EtchedBorder(), title));

  display = new JTextArea(10, 48);
  display.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
  display.setEditable(false);
  display.setForeground(fontColor);

  JScrollPane scroll = new JBScrollPane(display);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  middlePanel.add(scroll);

  add(middlePanel, BorderLayout.CENTER);

  JPanel progressPanel = new JPanel();
  progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
}
 
Example 3
Source File: MBasicTable.java    From javamelody with Apache License 2.0 6 votes vote down vote up
@Override
protected void configureEnclosingScrollPane() {
	// Si cette table est la viewportView d'un JScrollPane (la situation habituelle),
	// configure ce ScrollPane en positionnant la barre verticale à "always"
	// (et en installant le tableHeader comme columnHeaderView).
	super.configureEnclosingScrollPane();

	final Container parent = getParent();
	if (parent instanceof JViewport && parent.getParent() instanceof JScrollPane) {
		final JScrollPane scrollPane = (JScrollPane) parent.getParent();
		if (scrollPane.getVerticalScrollBar() != null) {
			scrollPane.getVerticalScrollBar().setFocusable(false);
		}
		if (scrollPane.getHorizontalScrollBar() != null) {
			scrollPane.getHorizontalScrollBar().setFocusable(false);
		}

		final JViewport viewport = scrollPane.getViewport();
		if (viewport == null || viewport.getView() != this) {
			return;
		}

		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	}
}
 
Example 4
Source File: InfoPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
Item(Color backgroundColor, int preferredHeight, JComponent innerPanel) {
    this.backgroundColor = backgroundColor;
    this.preferredHeight = preferredHeight;
    this.innerPanel = innerPanel;
    topGapPanel = createGapPanel();
    bottomGapPanel = createGapPanel();
    separator = createSeparator();
    outerPanel = new JPanel();
    outerPanel.setBackground(backgroundColor);
    outerPanel.setLayout(new BorderLayout());
    outerPanel.add(BorderLayout.NORTH, topGapPanel);
    outerPanel.add(BorderLayout.CENTER, innerPanel);
    outerPanel.add(BorderLayout.SOUTH, bottomGapPanel);
    outerPanel.setPreferredSize(new Dimension(0, preferredHeight));
    scrollPane = new JScrollPane();
    scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
    scrollPane.setPreferredSize(new Dimension(0, preferredHeight));
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setViewportView(outerPanel);
}
 
Example 5
Source File: EnvironmentVarsForm.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _envVarsTextArea.setName("envVarsTextArea");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_envVarsTextArea);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xy(4,2));

   _envVarsLabel.setName("envVarsLabel");
   _envVarsLabel.setText(Messages.getString("setVariables"));
   jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 });
   return jpanel1;
}
 
Example 6
Source File: SecondaryPanel.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
protected void makeGCodePanel() {
	// setup the elements
	gcode = new JTextArea();
	gcode.setEditable(true);
	gcode.setColumns(128);
	gcode.setRows(512);

	JScrollPane areaScrollPane = new JScrollPane(gcode);
	areaScrollPane.setVerticalScrollBarPolicy(
	                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

	gcodePanel = new JPanel(new GridBagLayout());

	// connect it together
	GridBagConstraints c = new GridBagConstraints();
	c.gridx=0;
	c.gridy=0;
	c.weightx=1.0;
	c.weighty=1.0;
	c.fill=GridBagConstraints.BOTH;
	c.insets = new Insets(3,3,3,3);		
	c.anchor=GridBagConstraints.CENTER;
	gcodePanel.add(areaScrollPane,c);
}
 
Example 7
Source File: JConsolePanel.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
//        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JConsolePanel cp = new JConsolePanel();
        cp.getOut().println("test hetre");
        cp.getOut().println("test next");
        cp.prompt();

        JScrollPane sp = new JScrollPane(cp);
        sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        f.getContentPane().add(sp);
        f.setSize(500, 500);
        f.setLocation(300, 300);
        f.setVisible(true);
    }
 
Example 8
Source File: GeopaparazziView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createdatabaseTreeView()
{
   _databaseTreeView.setName("databaseTreeView");
   TitledBorder titledborder1 = new TitledBorder(null,"Projects",TitledBorder.LEFT,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   _databaseTreeView.setBorder(titledborder1);
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:GROW(1.0)");
   CellConstraints cc = new CellConstraints();
   _databaseTreeView.setLayout(formlayout1);

   _databaseTree.setName("databaseTree");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_databaseTree);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   _databaseTreeView.add(jscrollpane1,new CellConstraints(1,1,1,1,CellConstraints.FILL,CellConstraints.FILL));

   addFillComponents(_databaseTreeView,new int[0],new int[0]);
   return _databaseTreeView;
}
 
Example 9
Source File: XSWHelpWindow.java    From SAMLRaider with MIT License 5 votes vote down vote up
public XSWHelpWindow() {
	setTitle("XML Signature Wrapping Help");
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 600, 400);
	setMinimumSize(new Dimension(600, 400));
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(new BorderLayout(0, 0));

	JLabel lblBeschreibung = new JLabel("<html>With xml wrapping attacks you try to trick the xml signature validator into validating an "
			+ "signature of an element while evaluating an other element. The XSWs in the image are supported." + "<br/>The blue element represents the signature."
			+ "<br/>The green one represents the original element, which is correctly signed. "
			+ "<br/>The red one represents the falsly evaluated element, if the validating is not correctly implemented."
			+ "<br/>Mind that the first two XSWs can be used for signed responses only whereas the other ones can be used for signed assertions only."
			+ "<br/> These XSW are taken from this paper: <br/> Somorovsky, Juraj, et al. \"On Breaking SAML: Be Whoever You Want to Be.\" USENIX Security Symposium. 2012."
			+ "<br/> Please check out this paper for further information." + "</html>");
	contentPane.add(lblBeschreibung, BorderLayout.NORTH);

	JScrollPane scrollPane = new JScrollPane();
	scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
	contentPane.add(scrollPane, BorderLayout.CENTER);

	ImagePanel panel;
	String className = getClass().getName().replace('.', '/');
	String classJar = getClass().getResource("/" + className + ".class").toString();
	if (classJar.startsWith("jar:")) {
		panel = new ImagePanel("xswlist.png");
	} else {
		panel = new ImagePanel("src/main/resources/xswlist.png");
	}

	scrollPane.setViewportView(panel);
}
 
Example 10
Source File: SimpleApp.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
private final void initializeTextArea(String[] args) {
 		JTextArea textArea = new JTextArea();
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
textArea.setEditable(false);

JScrollPane scrollPane = new JScrollPane();
   scrollPane.setViewportView(textArea);
   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   getContentPane().add(scrollPane);

textArea.setText(getMainProperties(args));
textArea.append(getAllProperties());
textArea.append(getEnvironmentVariables());
 	}
 
Example 11
Source File: MainPanel.java    From javamelody with Apache License 2.0 5 votes vote down vote up
MainPanel(RemoteCollector remoteCollector, Range selectedRange, boolean collectorServer)
		throws IOException {
	super(remoteCollector);
	this.collectorServer = collectorServer;
	// initialURLs avant setSelectedRange
	this.initialURLs = remoteCollector.getURLs();
	final String collectorUrl = initialURLs.get(0).toExternalForm();
	this.monitoringUrl = new URL(collectorUrl.substring(0, collectorUrl.indexOf('?')));

	setSelectedRange(selectedRange);

	CounterStorage.disableStorage();
	remoteCollector.disableAggregation();
	remoteCollector.collectDataIncludingCurrentRequests();

	scrollPane = new JScrollPane();
	scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	scrollPane.getVerticalScrollBar().setUnitIncrement(20);

	final JPanel mainTabPanel = new JPanel(new BorderLayout());
	mainTabPanel.setOpaque(false);
	final MainButtonsPanel mainButtonsPanel = new MainButtonsPanel(remoteCollector,
			getSelectedRange(), monitoringUrl, collectorServer);
	mainTabPanel.add(mainButtonsPanel, BorderLayout.NORTH);
	mainTabPanel.add(scrollPane, BorderLayout.CENTER);

	tabbedPane.addTab(getString("Tableau_de_bord"), mainTabPanel);
	tabbedPane.setTabComponentAt(0, null);
	add(tabbedPane, BorderLayout.CENTER);

	refreshMainTab();
}
 
Example 12
Source File: UserMessageDialog.java    From gepard with MIT License 5 votes vote down vote up
private void setupGUI() {
	setLayout(new GridBagLayout());
	
	GridBagConstraints c = new GridBagConstraints();
	
	c.insets = new Insets(5,5,5,5);
	
	c.gridx = 0; c.gridy = 0;
	c.weightx = 1; c.weighty = 1000;
	c.fill = GridBagConstraints.BOTH;  
	
	txtMessage = new JTextArea();
	JScrollPane scrolling = new JScrollPane(txtMessage);
	add(scrolling, c);
	
	c.gridy++;
	c.weighty = 1;
	c.fill = GridBagConstraints.VERTICAL;
	c.anchor = GridBagConstraints.EAST;
	JButton btnQuit;
	add(btnQuit = new JButton("Close"),c);
	
	// create border
	//txtMessage.setBorder(BorderFactory.createEtchedBorder() );
	// scrolling
	scrolling.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	scrolling.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
	// set font
	txtMessage.setFont(new Font("Courier", Font.PLAIN, 11));
	// additional flags
	txtMessage.setEditable(false);
	txtMessage.setLineWrap(true);
	txtMessage.setWrapStyleWord(true);
	
	// event handler
	btnQuit.addActionListener(this);
	
}
 
Example 13
Source File: NbEditorUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
    protected JComponent createExtComponent() {

        JTextComponent component = getComponent();
        
        JLayeredPane layers = new LayeredEditorPane(component);
        layers.add(component, JLayeredPane.DEFAULT_LAYER, 0);
//        MyInternalFrame window = new MyInternalFrame();
//        layers.add(window, JLayeredPane.PALETTE_LAYER);
//        window.show();

        // Add the scroll-pane with the component to the center
        JScrollPane scroller = new JScrollPane(layers);
        scroller.getViewport().setMinimumSize(new Dimension(4,4));

        // remove default scroll-pane border, winsys will handle borders itself 
        Border empty = BorderFactory.createEmptyBorder();
        // Important:  Do not delete or use null instead, will cause
        //problems on GTK L&F.  Must set both scroller border & viewport
        //border! - Tim
        scroller.setBorder(empty);
        scroller.setViewportBorder(empty);
        
        if (component.getClientProperty("nbeditorui.vScrollPolicy") != null) {
            scroller.setVerticalScrollBarPolicy(
                    (Integer)component.getClientProperty("nbeditorui.vScrollPolicy"));
        }
        if (component.getClientProperty("nbeditorui.hScrollPolicy") != null) {
            scroller.setHorizontalScrollBarPolicy(
                    (Integer)component.getClientProperty("nbeditorui.hScrollPolicy"));
        }
        // extComponent will be a panel
        JComponent ec = new JPanel(new BorderLayout());
        ec.putClientProperty(JTextComponent.class, component);
        ec.add(scroller);

        // Initialize sidebars
        // Need to clear the cache - it's null at this point when opening file but the sidebars
        // would be reused during L&F change (see BaseTextUI.UIWatcher) which would not work properly.
        CustomizableSideBar.resetSideBars(component);
        Map<SideBarPosition, JComponent> sideBars = CustomizableSideBar.getSideBars(component);
        processSideBars(sideBars, ec, scroller);
        
        if (listener == null){
            listener = new SideBarsListener(component);
            CustomizableSideBar.addChangeListener(NbEditorUtilities.getMimeType(component), listener);
        }
        
        // Initialize the corner component
        initGlyphCorner(scroller);

        return ec;
    }
 
Example 14
Source File: Solver.java    From algorithms-nutshell-2ed with MIT License 4 votes vote down vote up
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);
}
 
Example 15
Source File: ProLogWindow.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
private void settingsDetailsButtonActionPerformed() {
  final JDialog dialog = new JDialog(this, "Pro AI - Settings Details");
  String message = "";
  if (tabPaneMain.getSelectedIndex() == 0) { // Debugging
    message =
        "Debugging\r\n"
            + "\r\n"
            + "AI Logging: When this is checked, the AI's will output their logs, as they come "
            + "in, so you can see exactly what the AI is thinking.\r\n"
            + "Note that if you check this on, you still have to press OK then reopen the "
            + "settings window for the logs to actually start displaying.\r\n"
            + "\r\n"
            + "Log Depth: This setting lets you choose how deep you want the AI logging to be. "
            + "Fine only displays the high-level events, like the start of a phase, etc.\r\n"
            + "Finer displays medium-level events, such as attacks, reinforcements, etc.\r\n"
            + "Finest displays all the AI logging available. Can be used for detailed analysis, "
            + "but is a lot harder to read through it.\r\n"
            + "\r\n"
            + "Pause AI's: This checkbox pauses all the AI's while it's checked, so you can look "
            + "at the logs without the AI's outputting floods of information.\r\n"
            + "\r\n"
            + "Limit Log History To X Rounds: If this is checked, the AI log information will "
            + "be limited to X rounds of information.\r\n";
  }
  final JTextArea label = new JTextArea(message);
  label.setFont(new Font("Segoe UI", Font.PLAIN, 12));
  label.setEditable(false);
  label.setAutoscrolls(true);
  label.setLineWrap(false);
  label.setFocusable(false);
  label.setWrapStyleWord(true);
  label.setLocation(0, 0);
  dialog.setBackground(label.getBackground());
  dialog.setLayout(new BorderLayout());
  final JScrollPane pane = new JScrollPane();
  pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  pane.setViewportView(label);
  dialog.add(pane, BorderLayout.CENTER);
  final JButton button = new JButton("Close");
  button.setMinimumSize(new Dimension(100, 30));
  button.addActionListener(e -> dialog.dispose());
  dialog.add(button, BorderLayout.SOUTH);
  dialog.setMinimumSize(new Dimension(500, 300));
  dialog.setSize(new Dimension(800, 600));
  dialog.setResizable(true);
  dialog.setLocationRelativeTo(this);
  dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  dialog.setVisible(true);
}
 
Example 16
Source File: JreForm.java    From PyramidShader with GNU General Public License v3.0 4 votes vote down vote up
public JPanel createPanel()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _jrePathLabel.setName("jrePathLabel");
   _jrePathLabel.setText(Messages.getString("jrePath"));
   jpanel1.add(_jrePathLabel,cc.xy(2,2));

   _jreMinLabel.setName("jreMinLabel");
   _jreMinLabel.setText(Messages.getString("jreMin"));
   jpanel1.add(_jreMinLabel,cc.xy(2,6));

   _jreMaxLabel.setName("jreMaxLabel");
   _jreMaxLabel.setText(Messages.getString("jreMax"));
   jpanel1.add(_jreMaxLabel,cc.xy(2,8));

   _jvmOptionsTextLabel.setName("jvmOptionsTextLabel");
   _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions"));
   jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,16,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   _jreMinField.setName("jreMinField");
   jpanel1.add(_jreMinField,cc.xy(4,6));

   _jreMaxField.setName("jreMaxField");
   jpanel1.add(_jreMaxField,cc.xy(4,8));

   _jvmOptionsTextArea.setName("jvmOptionsTextArea");
   _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip"));
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_jvmOptionsTextArea);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xywh(4,16,7,1));

   _initialHeapSizeLabel.setName("initialHeapSizeLabel");
   _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize"));
   jpanel1.add(_initialHeapSizeLabel,cc.xy(2,12));

   _maxHeapSizeLabel.setName("maxHeapSizeLabel");
   _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize"));
   jpanel1.add(_maxHeapSizeLabel,cc.xy(2,14));

   JLabel jlabel1 = new JLabel();
   jlabel1.setText("MB");
   jpanel1.add(jlabel1,cc.xy(6,12));

   JLabel jlabel2 = new JLabel();
   jlabel2.setText("MB");
   jpanel1.add(jlabel2,cc.xy(6,14));

   _initialHeapSizeField.setName("initialHeapSizeField");
   jpanel1.add(_initialHeapSizeField,cc.xy(4,12));

   _maxHeapSizeField.setName("maxHeapSizeField");
   jpanel1.add(_maxHeapSizeField,cc.xy(4,14));

   _maxHeapPercentField.setName("maxHeapPercentField");
   jpanel1.add(_maxHeapPercentField,cc.xy(8,14));

   _initialHeapPercentField.setName("initialHeapPercentField");
   jpanel1.add(_initialHeapPercentField,cc.xy(8,12));

   _jdkPreferenceCombo.setName("jdkPreferenceCombo");
   jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,6,3,1));

   JLabel jlabel3 = new JLabel();
   jlabel3.setText(Messages.getString("availableMemory"));
   jpanel1.add(jlabel3,cc.xy(10,12));

   JLabel jlabel4 = new JLabel();
   jlabel4.setText(Messages.getString("availableMemory"));
   jpanel1.add(jlabel4,cc.xy(10,14));

   _runtimeBitsCombo.setName("runtimeBitsCombo");
   _runtimeBitsCombo.setToolTipText("");
   jpanel1.add(_runtimeBitsCombo,cc.xywh(8,8,3,1));

   jpanel1.add(createPanel1(),cc.xywh(2,18,9,1));
   TitledSeparator titledseparator1 = new TitledSeparator();
   titledseparator1.setText(Messages.getString("searchOptions"));
   jpanel1.add(titledseparator1,cc.xywh(2,4,9,1));

   TitledSeparator titledseparator2 = new TitledSeparator();
   titledseparator2.setText(Messages.getString("options"));
   jpanel1.add(titledseparator2,cc.xywh(2,10,9,1));

   jpanel1.add(createPanel2(),cc.xywh(4,2,7,1));
   addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 });
   return jpanel1;
}
 
Example 17
Source File: PreferencesDialog.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
private JScrollPane getGameplaySettingsPanel1() {

        hideAIPromptCheckBox = new MCheckBox(getAsHtml(MText.get(_S15)), config.getHideAiActionPrompt());
        hideAIPromptCheckBox.setToolTipText(MText.get(_S16));
        setButtonPropertyDefaults(hideAIPromptCheckBox);

        mulliganScreenCheckbox = new MCheckBox(getAsHtml(MText.get(_S17)), config.showMulliganScreen());
        setButtonPropertyDefaults(mulliganScreenCheckbox);

        touchscreenCheckBox = new MCheckBox(getAsHtml(MText.get(_S20)), config.isTouchscreen());
        setButtonPropertyDefaults(touchscreenCheckBox);

        skipSingleCheckBox = new MCheckBox(getAsHtml(MText.get(_S21)), config.getSkipSingle());
        skipSingleCheckBox.setToolTipText(MText.get(_S22));
        setButtonPropertyDefaults(skipSingleCheckBox);

        alwaysPassCheckBox = new MCheckBox(getAsHtml(MText.get(_S23)), GeneralConfig.get(BooleanSetting.ALWAYS_PASS));
        setButtonPropertyDefaults(alwaysPassCheckBox);

        smartTargetCheckBox = new MCheckBox(getAsHtml(MText.get(_S24)), config.getSmartTarget());
        smartTargetCheckBox.setToolTipText(MText.get(_S25));
        setButtonPropertyDefaults(smartTargetCheckBox);

        messageDelaySlider = new SliderPanel(getAsHtml(MText.get(_S26)), 0, 3000, 500, config.getMessageDelay());
        messageDelaySlider.setToolTipText(MText.get(_S27));
        messageDelaySlider.addMouseListener(this);

        final ScrollablePanel panel = new ScrollablePanel(new MigLayout("flowy, insets 16, gapy 10"));
        panel.setScrollableWidth(ScrollablePanel.ScrollableSizeHint.FIT);

        panel.add(hideAIPromptCheckBox.component());
        panel.add(mulliganScreenCheckbox.component());
        panel.add(touchscreenCheckBox.component());
        panel.add(skipSingleCheckBox.component());
        panel.add(alwaysPassCheckBox.component());
        panel.add(smartTargetCheckBox.component());
        panel.add(messageDelaySlider, "w 100%");

        final JScrollPane scroller = new JScrollPane(panel);
        scroller.getVerticalScrollBar().setUnitIncrement(18);
        scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        return scroller;

    }
 
Example 18
Source File: TemplateListWindow.java    From wpcleaner with Apache License 2.0 4 votes vote down vote up
/**
 * @return Window components.
 */
@Override
protected Component createComponents() {
  JPanel panel = new JPanel(new GridBagLayout());

  // Initialize constraints
  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.gridheight = 1;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.insets = new Insets(0, 0, 0, 0);
  constraints.ipadx = 0;
  constraints.ipady = 0;
  constraints.weightx = 1;
  constraints.weighty = 0;

  // Label
  JLabel label = Utilities.createJLabel(GT._T(
      "Templates used in {0}, linking to {1}",
      new Object[] { page.getTitle(), link.getTitle() }));
  panel.add(label, constraints);
  constraints.gridy++;

  // Menu
  modelLinks = new PageListModel();
  modelLinks.setShowDisambiguation(true);
  modelLinks.setShowOther(true);

  // Links
  constraints.fill = GridBagConstraints.BOTH;
  constraints.weighty = 1;
  listLinks = new JList<Page>(modelLinks);
  listLinks.setCellRenderer(new PageListCellRenderer());
  listLinks.addMouseListener(new BasicPageListPopupListener(getWikipedia(), null, listLinks, this));
  listLinks.addMouseListener(new PageListAnalyzeListener(getWikipedia(), null));
  JScrollPane scrollLinks = new JScrollPane(listLinks);
  scrollLinks.setMinimumSize(new Dimension(100, 100));
  scrollLinks.setPreferredSize(new Dimension(200, 500));
  scrollLinks.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  panel.add(scrollLinks, constraints);
  constraints.gridy++;

  return panel;
}
 
Example 19
Source File: AboutGrammarVizDialog.java    From grammarviz2_src with GNU General Public License v2.0 4 votes vote down vote up
public AboutGrammarVizDialog(JFrame parentFrame) {

    super(parentFrame, true);
    if (parentFrame != null) {
      Dimension parentSize = parentFrame.getSize();
      Point p = parentFrame.getLocation();
      setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
    }

    JEditorPane aboutTextPane = new JEditorPane();

    aboutTextPane.setEditable(false);
    java.net.URL helpURL = AboutGrammarVizDialog.class.getResource("/AboutText.html");
    if (helpURL != null) {
      try {
        aboutTextPane.setPage(helpURL);
      }
      catch (IOException e) {
        System.err.println("Attempted to read a bad URL: " + helpURL);
      }
    }
    else {
      System.err.println("Couldn't find file: AboutText.html");
    }

    // Put the editor pane in a scroll pane.
    JScrollPane editorScrollPane = new JScrollPane(aboutTextPane);
    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    MigLayout mainFrameLayout = new MigLayout("fill", "[grow,center]", "[grow]5[]");

    getContentPane().setLayout(mainFrameLayout);

    getContentPane().add(editorScrollPane, "h 200:300:,w 400:500:,growx,growy,wrap");

    JPanel buttonPane = new JPanel();
    JButton okButton = new JButton(OK_BUTTON_TEXT);

    buttonPane.add(okButton);
    okButton.addActionListener(this);

    getContentPane().add(buttonPane, "wrap");

    pack();
    setVisible(true);

  }
 
Example 20
Source File: MessagesForm.java    From PyramidShader with GNU General Public License v3.0 4 votes vote down vote up
public JPanel createPanel()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _startupErrTextArea.setName("startupErrTextArea");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_startupErrTextArea);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xy(4,4));

   _bundledJreErrTextArea.setName("bundledJreErrTextArea");
   JScrollPane jscrollpane2 = new JScrollPane();
   jscrollpane2.setViewportView(_bundledJreErrTextArea);
   jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane2,cc.xy(4,6));

   _jreVersionErrTextArea.setName("jreVersionErrTextArea");
   _jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip"));
   JScrollPane jscrollpane3 = new JScrollPane();
   jscrollpane3.setViewportView(_jreVersionErrTextArea);
   jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane3,cc.xy(4,8));

   _launcherErrTextArea.setName("launcherErrTextArea");
   JScrollPane jscrollpane4 = new JScrollPane();
   jscrollpane4.setViewportView(_launcherErrTextArea);
   jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane4,cc.xy(4,10));

   JLabel jlabel1 = new JLabel();
   jlabel1.setText(Messages.getString("startupErr"));
   jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   JLabel jlabel2 = new JLabel();
   jlabel2.setText(Messages.getString("bundledJreErr"));
   jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   JLabel jlabel3 = new JLabel();
   jlabel3.setText(Messages.getString("jreVersionErr"));
   jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   JLabel jlabel4 = new JLabel();
   jlabel4.setText(Messages.getString("launcherErr"));
   jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   _messagesCheck.setActionCommand("Add version information");
   _messagesCheck.setName("messagesCheck");
   _messagesCheck.setText(Messages.getString("addMessages"));
   jpanel1.add(_messagesCheck,cc.xy(4,2));

   JLabel jlabel5 = new JLabel();
   jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg"));
   jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));

   _instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea");
   _instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip"));
   JScrollPane jscrollpane5 = new JScrollPane();
   jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea);
   jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane5,cc.xy(4,12));

   addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 });
   return jpanel1;
}