Java Code Examples for javax.swing.JScrollPane#HORIZONTAL_SCROLLBAR_AS_NEEDED

The following examples show how to use javax.swing.JScrollPane#HORIZONTAL_SCROLLBAR_AS_NEEDED . 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: PropertiesTable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init(JLabel label, String[] columns) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    table = new JTable(tableModel);
    table.getTableHeader().setReorderingAllowed(false);
    table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.setRowHeight(table.getRowHeight());
    table.addAncestorListener(this);
    component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    component.setPreferredSize(new Dimension(340, 150));
    table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N        
    table.getAccessibleContext().setAccessibleName(NbBundle.getMessage(PropertiesTable.class, "ACSN_PropertiesTable")); // NOI18N        
    label.setLabelFor(table);
    setColumns(columns);
}
 
Example 2
Source File: ListManufacturerPane.java    From OpERP with MIT License 6 votes vote down vote up
public ListManufacturerPane() {
	pane = new JPanel(new MigLayout("fill"));

	table = new JTable();
	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isLeftMouseButton(e)
					&& e.getClickCount() == 2
					&& table.getSelectedRow() != -1) {

				Manufacturer manufacturer = tableModel.getRow(table
						.getSelectedRow());

				manufacturerDetailsPane.show(manufacturer, getPane());
			}
		}
	});

	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

	pane.add(scrollPane, "grow");
}
 
Example 3
Source File: AnalysisControllerUI.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initComponents(URL ruleBase, String htmlDescription) {
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    HTMLTextArea descriptionArea = new HTMLTextArea();
    HTMLDocument hdoc = (HTMLDocument) descriptionArea.getDocument();
    descriptionArea.setText(htmlDescription);
    descriptionArea.setCaretPosition(0);
    hdoc.setBase(ruleBase);

    JScrollPane descriptionAreaScrollPane = new JScrollPane(descriptionArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    descriptionAreaScrollPane.setPreferredSize(new Dimension(375, 220));

    add(descriptionAreaScrollPane, BorderLayout.CENTER);
}
 
Example 4
Source File: ProfilerJDBCPanel.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private static TextAreaComponent createTextArea(int rows) {
    final JTextArea rootsArea = new JTextArea();
    rootsArea.setFont(new Font("Monospaced", Font.PLAIN, UIManager.getFont("Label.font").getSize())); // NOI18N
    TextAreaComponent rootsAreaScrollPane = new TextAreaComponent(rootsArea,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
        public void setEnabled(boolean enabled) {
            super.setEnabled(enabled);
            rootsArea.setEnabled(enabled);
        }
    };
    rootsAreaScrollPane.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    JTextArea referenceArea = new JTextArea("X"); // NOI18N
    referenceArea.setFont(rootsArea.getFont());
    referenceArea.setRows(rows);
    Insets insets = rootsAreaScrollPane.getInsets();
    rootsAreaScrollPane.setPreferredSize(new Dimension(1, referenceArea.getPreferredSize().height + 
            (insets != null ? insets.top + insets.bottom : 0)));
    return rootsAreaScrollPane;
}
 
Example 5
Source File: RESTResourcesPanel.java    From mobile-persistence with MIT License 6 votes vote down vote up
private void buildPayloadDialog()
{
  payloadDialog = JEWTDialog.createDialog(this, "Sample Return Payload", JEWTDialog.BUTTON_DEFAULT);
  JPanel headersPanel = new JPanel();
  payloadDialog.setContent(headersPanel);
  payloadDialog.setPreferredSize(500, 450);
  payloadDialog.setResizable(true);
  payloadDialog.setModal(true);
  payloadDialog.setButtonMask((JEWTDialog.BUTTON_OK | JEWTDialog.BUTTON_CANCEL));
  payloadDialog.setDefaultButton(JEWTDialog.BUTTON_OK);
  GridBagLayout containerLayout = new GridBagLayout();
  headersPanel.setLayout(containerLayout);
  payloadField.setAutoscrolls(true);
  payloadField.setLineWrap(true);
  JScrollPane sp = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  headersPanel.add(sp, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.LINE_START
                  , GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));    
  sp.setViewportView(payloadField);
}
 
Example 6
Source File: ListItemPane.java    From OpERP with MIT License 6 votes vote down vote up
public ListItemPane() {
	pane = new JPanel(new MigLayout("fill"));

	table = new JTable();
	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isLeftMouseButton(e)
					&& e.getClickCount() == 2
					&& table.getSelectedRow() != -1) {

				Item item = tableModel.getRow(table.getSelectedRow());

				itemDetailsPane.show(item, getPane());
			}
		}
	});
	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

	pane.add(scrollPane, "grow");
}
 
Example 7
Source File: ProfilerMemoryPanel.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private static TextAreaComponent createTextArea(int rows) {
    final JTextArea rootsArea = new JTextArea();
    rootsArea.setFont(new Font("Monospaced", Font.PLAIN, UIManager.getFont("Label.font").getSize())); // NOI18N
    TextAreaComponent rootsAreaScrollPane = new TextAreaComponent(rootsArea,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
        public void setEnabled(boolean enabled) {
            super.setEnabled(enabled);
            rootsArea.setEnabled(enabled);
        }
    };
    rootsAreaScrollPane.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    JTextArea referenceArea = new JTextArea("X"); // NOI18N
    referenceArea.setFont(rootsArea.getFont());
    referenceArea.setRows(rows);
    Insets insets = rootsAreaScrollPane.getInsets();
    rootsAreaScrollPane.setPreferredSize(new Dimension(1, referenceArea.getPreferredSize().height + 
            (insets != null ? insets.top + insets.bottom : 0)));
    return rootsAreaScrollPane;
}
 
Example 8
Source File: ListWarehousePane.java    From OpERP with MIT License 6 votes vote down vote up
public ListWarehousePane() {
	pane = new JPanel();
	pane.setLayout(new MigLayout("fill"));
	table = new JTable(tableModel);
	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isLeftMouseButton(e)
					&& e.getClickCount() == 2
					&& table.getSelectedRow() != -1) {
				Warehouse warehouse = tableModel.getRow(table
						.getSelectedRow());
				warehouseDetailsPane.show(warehouse, getPane());

			}
		}
	});

	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	pane.add(scrollPane, "grow");

}
 
Example 9
Source File: LoadGenProfilingPoint.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                String urlString = url.toString();

                if (START_LOCATION_URLMASK.equals(urlString)) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getStartLocation());
                } else if (LoadGenProfilingPoint.this.usesEndLocation()) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getEndLocation());
                }
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.LoadGenProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
Example 10
Source File: MapGeneratorOptionsDialog.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a dialog to set the map generator options.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param editable Whether the options may be edited.
 */
public MapGeneratorOptionsDialog(FreeColClient freeColClient, JFrame frame,
                                 boolean editable) {
    super(freeColClient, frame, editable,
          freeColClient.getGame().getMapGeneratorOptions(),
          MapGeneratorOptions.TAG,
          FreeColDirectories.MAP_GENERATOR_OPTIONS_FILE_NAME,
          MapGeneratorOptions.TAG);

    if (isEditable()) {
        loadDefaultOptions();
        // FIXME: The update should be solved by PropertyEvent.

        final List<File> mapFiles = FreeColDirectories.getMapFileList();
        JPanel mapPanel = new JPanel();
        for (File f : mapFiles) {
            JButton mapButton = makeMapButton(f);
            if (mapButton == null) continue;
            mapButton.addActionListener((ActionEvent ae) -> {
                    updateFile(f);
                });
            mapPanel.add(mapButton);
        }

        JScrollPane scrollPane = new JScrollPane(mapPanel,
            JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.getVerticalScrollBar().setUnitIncrement(16);
        scrollPane.getViewport().setOpaque(false);
        panel.add(scrollPane, "height 80%, width 100%");
    }
    initialize(frame, choices());
}
 
Example 11
Source File: WarehouseDetailsPane.java    From OpERP with MIT License 5 votes vote down vote up
public WarehouseDetailsPane() {
	pane = new JPanel();
	pane.setLayout(new MigLayout("", "[][grow,center]", "[][][][grow]"));

	JLabel lblWarehouseId = new JLabel("Warehouse Id");
	pane.add(lblWarehouseId, "cell 0 0,alignx trailing");

	warehouseIdField = new JTextField();
	warehouseIdField.setColumns(10);
	warehouseIdField.setEditable(false);
	pane.add(warehouseIdField, "cell 1 0,growx");

	JLabel lblWarehouseName = new JLabel("Warehouse Name");
	pane.add(lblWarehouseName, "cell 0 1,alignx trailing");

	warehouseNameField = new JTextField();
	pane.add(warehouseNameField, "cell 1 1,growx");
	warehouseNameField.setEditable(false);
	warehouseNameField.setColumns(10);

	lblItemsInThis = new JLabel("Items In this Warehouse");
	pane.add(lblItemsInThis, "cell 1 2");

	table = new JTable(tableModel);
	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	scrollPane.setPreferredSize(new Dimension(456, 200));
	pane.add(scrollPane, "cell 1 3,grow");

}
 
Example 12
Source File: MetalworksDocumentFrame.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 13
Source File: MBeansOperationsView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());
    setOpaque(false);

    JPanel operations = mbeansTab.getOperationsPanel();

    JScrollPane operationsScrollPane = new JScrollPane(operations, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    operationsScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());

    add(operationsScrollPane, BorderLayout.CENTER);
}
 
Example 14
Source File: MetalworksDocumentFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 15
Source File: MBeansMetadataView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());
    setOpaque(false);

    JPanel metadata = mbeansTab.getMetadataPanel();

    JScrollPane metadataScrollPane = new JScrollPane(metadata, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    metadataScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());

    add(metadataScrollPane, BorderLayout.CENTER);
}
 
Example 16
Source File: MetalworksDocumentFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 17
Source File: EmailPanel.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
protected void buildContent() {
	setLayout(new GridBagLayout());
	
	this.enabledCheckBox = new JCheckBox();
	this.enabledCheckBox.setText("Email Enabled");
	this.enabledCheckBox.addActionListener(new EnableAction());
	
	this.emailAddressText = new JTextField();
	this.incomingHostText = new JTextField();
	this.incomingPortText = new JTextField();
	this.outgoingHostText = new JTextField();
	this.outgoingPortText = new JTextField();
	this.protocolText = new JTextField();
	this.usernameText = new JTextField();
	this.passwordText = new JTextField();
	
	this.signatureText = new JTextArea();
	JScrollPane signatureScrollPane = new JScrollPane(this.signatureText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	
	
	this.isSSLRequiredCheckBox = new JCheckBox();
	this.isSSLRequiredCheckBox.setText("SSL");
	
	add(this.enabledCheckBox, new GridBagConstraints(0,0,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Email Address:"), new GridBagConstraints(0,1,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.emailAddressText, new GridBagConstraints(1,1,1,1, 1.0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Incoming Host:"), new GridBagConstraints(0,2,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.incomingHostText, new GridBagConstraints(1,2,1,1, 1.0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Incoming Port:"), new GridBagConstraints(0,3,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.incomingPortText, new GridBagConstraints(1,3,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Outgoing Host:"), new GridBagConstraints(0,4,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.outgoingHostText, new GridBagConstraints(1,4,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Outgoing Port:"), new GridBagConstraints(0,5,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.outgoingPortText, new GridBagConstraints(1,5,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Protocol:"), new GridBagConstraints(0,6,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.protocolText, new GridBagConstraints(1,6,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.isSSLRequiredCheckBox, new GridBagConstraints(0,7,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Username:"), new GridBagConstraints(0,8,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.usernameText, new GridBagConstraints(1,8,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Password:"), new GridBagConstraints(0,9,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.passwordText, new GridBagConstraints(1,9,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Signature:"), new GridBagConstraints(0,10,1,1, 0,0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(signatureScrollPane, new GridBagConstraints(0,11,3,3, 1.0,1.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	
	resetState();
}
 
Example 18
Source File: IRCPanel.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
protected void buildContent() {
	setLayout(new GridBagLayout());
			
	this.outputTextPane = new JTextArea();
	this.outputTextPane.setEditable(false);
	this.outputScrollPane = new JScrollPane(this.outputTextPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	
	this.stateComboBox = new JComboBox(LanguageState.values());
	this.stateComboBox.addActionListener(new StateChangedAction());
	
	this.connectButton = new JButton("Connect");
	this.connectButton.addActionListener(new ConnectAction());
	
	this.disconnectButton = new JButton("Disconnect");
	this.disconnectButton.addActionListener(new DisconnectAction());
	
	this.clearButton = new JButton("Clear");
	this.clearButton.addActionListener(new ClearAction());
	
	this.serverComboBox = new JComboBox();
	this.serverComboBox.setEditable(true);
	this.serverComboBox.addItem("irc.freenode.org");
	this.serverComboBox.addItem("irc.icq.com");
	this.serverComboBox.addItem("irc.quakenet.org");
	this.serverComboBox.addItem("irc.efnet.org");
	this.serverComboBox.addItem("irc.undernet.org");
	this.channelComboBox = new JComboBox();
	this.channelComboBox.setEditable(true);
	this.channelComboBox.addItem("#Bot");
	this.channelComboBox.addItem("#ai");
	this.channelComboBox.addItem("##linux");
	this.channelComboBox.addItem("##politics");
	this.channelComboBox.addItem("#teens");
	this.channelComboBox.addItem("#20_something");
	this.channelComboBox.addItem("#30_something");
	this.channelComboBox.addItem("#40_something");
	this.channelComboBox.addItem("#christianity");
	this.channelComboBox.addItem("#buddhism");		
	
	this.nickText = new JTextField();
	
	add(this.outputScrollPane, new GridBagConstraints(0,0,1,15, 1.0,0.5, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.connectButton, new GridBagConstraints(1,0,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.disconnectButton, new GridBagConstraints(1,1,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.clearButton, new GridBagConstraints(1,2,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.stateComboBox, new GridBagConstraints(1,3,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Server:"), new GridBagConstraints(1,4,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.serverComboBox, new GridBagConstraints(1,5,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Channel:"), new GridBagConstraints(1,6,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.channelComboBox, new GridBagConstraints(1,7,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Nick:"), new GridBagConstraints(1,8,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.nickText, new GridBagConstraints(1,9,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	
	resetBotInstance();
}
 
Example 19
Source File: TextPanel.java    From BotLibre with Eclipse Public License 1.0 4 votes vote down vote up
protected void buildContent() {
	setLayout(new GridBagLayout());
			
	this.inputTextPane = new JTextArea();
	initKeyMap(this.inputTextPane);
	this.inputScrollPane = new JScrollPane(this.inputTextPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	
	this.outputTextPane = new JTextPane();
	this.outputTextPane.setContentType("text/html");
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = new HTMLDocument();
    this.outputTextPane.setEditorKit(kit);
    this.outputTextPane.setDocument(doc);
	this.outputTextPane.setEditable(false);
	this.outputScrollPane = new JScrollPane(this.outputTextPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	DefaultCaret caret = (DefaultCaret) this.outputTextPane.getCaret();
	caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
	
	this.submitButton = new JButton("Submit");
	this.submitButton.addActionListener(new SubmitAction());
	
	this.clearButton = new JButton("Clear");
	this.clearButton.addActionListener(new ClearAction());
	
	this.stateComboBox = new JComboBox(LanguageState.values());
	this.stateComboBox.addActionListener(new StateChangedAction());
	
	this.emotionComboBox = new JComboBox(EmotionalState.values());
	this.emotionComboBox.addActionListener(new EmotionChangedAction());

	this.correctionCheckBox = new JCheckBox("Correction");
	this.offensiveCheckBox = new JCheckBox("Offensive");
			
	this.avatarLabel = new JLabel();
	
	add(this.outputScrollPane, new GridBagConstraints(0,0,1,10, 1.0,1.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.inputScrollPane, new GridBagConstraints(0,10,1,10, 1.0,0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,50));
	add(this.submitButton, new GridBagConstraints(1,0,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.clearButton, new GridBagConstraints(1,1,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Language state:"), new GridBagConstraints(1,2,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.stateComboBox, new GridBagConstraints(1,3,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(new JLabel("Emote:"), new GridBagConstraints(1,4,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.emotionComboBox, new GridBagConstraints(1,5,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.correctionCheckBox, new GridBagConstraints(1,6,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.offensiveCheckBox, new GridBagConstraints(1,7,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	add(this.avatarLabel, new GridBagConstraints(1,8,1,1, 0.0,0.0, GridBagConstraints.CENTER,GridBagConstraints.BOTH, new Insets(4,4,4,4), 0,0));
	
	resetBotInstance();		
}
 
Example 20
Source File: DetailsPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}