Java Code Examples for javax.swing.JScrollPane#HORIZONTAL_SCROLLBAR_NEVER

The following examples show how to use javax.swing.JScrollPane#HORIZONTAL_SCROLLBAR_NEVER . 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: DomBotSelector.java    From DominionSim with MIT License 6 votes vote down vote up
private JPanel getSelectionPanel() {
    final JPanel thePanel = new JPanel();
    thePanel.setLayout( new GridBagLayout() );
    final GridBagConstraints theCons = DomGui.getGridBagConstraints( 2 );
    JScrollPane theTypePane = new JScrollPane(getBotTypeList(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    theTypePane.setBorder(new TitledBorder( "Type" ));
    theCons.weightx = 0.0;
    theCons.weighty = 1.0;
    thePanel.add(theTypePane, theCons);

    theCons.weightx = 1.0;
    theCons.gridx++;
    thePanel.add(getBotPanel(), theCons);

    return thePanel;
}
 
Example 2
Source File: StartupConfigurator.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.setEditable(false);
    rootsArea.setFont(new Font("Monospaced", Font.PLAIN, UIManager.getFont("Label.font").getSize())); // NOI18N
    TextAreaComponent rootsAreaScrollPane = new TextAreaComponent(rootsArea,
            JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        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 3
Source File: SearchMediaItemView.java    From java-photoslibrary with Apache License 2.0 6 votes vote down vote up
/** Creates a border-layout panel with padding. */
private JPanel initializeContentPanel() {
  JPanel panel = new JPanel();
  panel.setLayout(new BorderLayout(0 /* hgap */, 20 /* vgap */));

  JScrollPane scrollPane =
      new JScrollPane(
          panel,
          JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.setBorder(UIHelper.NO_BORDER);

  JPanel outerPanel = new JPanel();
  outerPanel.setLayout(new GridLayout(1 /* rows */, 1 /* cols */));
  outerPanel.setBorder(CONTENT_BORDER);
  outerPanel.add(scrollPane);
  add(outerPanel, BorderLayout.CENTER);

  return panel;
}
 
Example 4
Source File: AddOrEditPromotionDialog.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public void init() {
	this.okButton.setText("确定");
	this.okButton.setActionCommand(ActionName.OK.toString());
	this.okButton.addActionListener(this);
	this.cancelButton.setText("取消");
	this.cancelButton.setActionCommand(ActionName.CANCEL.toString());
	this.cancelButton.addActionListener(this);
	this.tipFields.setColumns(20);
	this.tipFields.setRows(20);
	
	if ( this.pojo != null ) {
		this.idField.setValue(this.pojo.getId());
		this.channelField.setText(this.pojo.getChannel());
		this.startField.setDate(new Date(this.pojo.getStartMillis()));
		this.endField.setDate(new Date(this.pojo.getEndMillis()));
		this.tipFields.setText(this.pojo.getMessage());
	}
	
	this.setLayout(new MigLayout("wrap 4"));
	this.setSize(400, 300);
	this.add(new JLabel("ID:"));
	this.add(idField, "width 10%, sg fd");
	this.add(channelLabel, "sg lbl");
	this.add(channelField, "sg fd");
	this.add(startLabel, "");
	this.add(startField, "sg fd");
	this.add(endLabel, "");
	this.add(endField, "sg fd");
	this.add(new JLabel("公告信息:"), "sg lbl");
	JScrollPane pane = new JScrollPane(tipFields, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	this.add(pane, "span, growx");
	this.add(okButton, "span, split 2, align center");
	this.add(cancelButton);
	
	this.setResizable(true);
	Point c = WindowUtils.getPointForCentering(this);
	this.setLocation(c);
	this.setModal(true);
}
 
Example 5
Source File: ItemDetailPanel.java    From osrsclient with GNU General Public License v2.0 5 votes vote down vote up
private void setup() {
    setLayout(new MigLayout("ins 0,align center, "));
    setBackground(new Color(51, 51, 51));
    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    wtbButton = new JToggleButton("WTB");
    wtsButton = new JToggleButton("WTS");
    wtbButton.setSelected(true);
    wtsButton.setSelected(true);
    itemSelectedLabel = new JLabel();
    itemSelectedLabel.setMaximumSize(new Dimension(160, 50));

    offerModel = new OfferModel();
    offerTable = new JTable(offerModel);

    //Setting up ideal column widths
    offerTable.getColumnModel().getColumn(0).setPreferredWidth(17);
    offerTable.getColumnModel().getColumn(1).setPreferredWidth(50);
    offerTable.getColumnModel().getColumn(3).setPreferredWidth(110);

    listScroller = new JScrollPane(offerTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    add(wtbButton, "cell 0 2,gapy 0");
    add(wtsButton, "cell 1 2, align right, spanx");
    add(new JLabel("Item:"), "cell 0 5, gapy 0, align left ");
    add(itemSelectedLabel, "cell 1 5, gapy 0, align left");
    add(listScroller, "cell 0 4,width 100%,height 100%,spanx");

}
 
Example 6
Source File: LogBox.java    From ChatGameFontificator with The Unlicense 5 votes vote down vote up
public LogBox()
{
    super(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    this.authCode = null;

    output = new JTextArea();
    output.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    output.setWrapStyleWord(true);
    output.setLineWrap(true);
    output.setEditable(false);
    output.setBackground(getBackground());

    super.setViewportView(output);
}
 
Example 7
Source File: StatisticsPanel.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the statistics panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param serverStatistics A map of key,value pairs of server statistics.
 * @param clientStatistics A map of key,value pairs of client statistics.
 */
public StatisticsPanel(FreeColClient freeColClient,
                       Map<String, String> serverStatistics,
                       Map<String, String> clientStatistics) {
    super(freeColClient, null, new BorderLayout());

    // Title
    JPanel header = new JPanel();
    this.add(header, BorderLayout.PAGE_START);
    header.add(Utility.localizedLabel("statistics"), JPanel.CENTER_ALIGNMENT);

    // Actual stats panel
    JPanel statsPanel = new JPanel(new GridLayout(1,2));
    JScrollPane scrollPane = new JScrollPane(statsPanel,
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // correct way to make scroll pane opaque
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setBorder(null);

    this.add(scrollPane,BorderLayout.CENTER);
    statsPanel.add(displayStatsMessage("client", clientStatistics));
    statsPanel.add(displayStatsMessage("server", serverStatistics));

    add(okButton, BorderLayout.PAGE_END);

    setSize(getPreferredSize());
}
 
Example 8
Source File: TracerOptionsPanelController.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent getComponent() {
    if (component == null) {
        ScrollableContainer container = new ScrollableContainer(getPanel(),
                                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        container.setViewportBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
        container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
        component = container;
    }
    return component;
}
 
Example 9
Source File: OutlineView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
    * Determines when the horizontal scrollbar appears in the tree column.
    * The options are:<ul>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED</code>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER</code>
    * <li><code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS</code>
    * </ul>
    *
    * @param policy one of the three values listed above
    * @exception IllegalArgumentException if <code>policy</code>
    *				is not one of the legal values shown above
    * @see #getTreeHorizontalScrollBarPolicy
    * @since 6.30
    *
    * @beaninfo
    *   preferred: true
    *       bound: true
    * description: The tree column scrollbar policy
    *        enum: HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
    *              HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
    *              HORIZONTAL_SCROLLBAR_ALWAYS ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
    */
   public void setTreeHorizontalScrollBarPolicy(int policy) {
       if (policy == treeHorizontalScrollBarPolicy) {
           return ;
       }
switch (policy) {
           case HORIZONTAL_SCROLLBAR_AS_NEEDED:
           case HORIZONTAL_SCROLLBAR_NEVER:
           case HORIZONTAL_SCROLLBAR_ALWAYS:
                   break;
           default:
               throw new IllegalArgumentException("invalid treeHorizontalScrollBarPolicy");
}
int old = treeHorizontalScrollBarPolicy;
treeHorizontalScrollBarPolicy = policy;
       boolean wasHScrollBarVisible = isTreeHScrollBar;
       isTreeHScrollBar = (policy != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
       if (wasHScrollBarVisible != isTreeHScrollBar) {
           if (!wasHScrollBarVisible) {
               outline.getColumnModel().addColumnModelListener(listener);
           } else {
               outline.getColumnModel().removeColumnModelListener(listener);
           }
           outline.setTreeHScrollingEnabled(isTreeHScrollBar, hScrollBar);
       }
firePropertyChange("treeHorizontalScrollBarPolicy", old, policy);
revalidate();
repaint();
   }
 
Example 10
Source File: PhotoListView.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
private JScrollPane initializePhotoGridPanel(Iterable<MediaItem> seedMediaItems)
    throws MalformedURLException {
  photoGridPanel = new JPanel();
  photoGridPanel.setLayout(
      new GridLayout(0 /* unlimited rows */, ITEMS_PER_ROW, ITEM_GRID_HGAP, ITEM_GRID_VGAP));
  addNewMediaItemsToPanel(seedMediaItems);

  JScrollPane scrollPane =
      new JScrollPane(
          photoGridPanel,
          JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.setBorder(UIHelper.NO_BORDER);
  return scrollPane;
}
 
Example 11
Source File: AlbumListView.java    From java-photoslibrary with Apache License 2.0 5 votes vote down vote up
private JScrollPane initializeAlbumGridPanel(Iterable<Album> seedAlbums)
    throws MalformedURLException {
  albumGridPanel = new JPanel();
  albumGridPanel.setLayout(
      new GridLayout(0 /* unlimited rows */, ITEMS_PER_ROW, ITEM_GRID_HGAP, ITEM_GRID_VGAP));
  addAlbumsToPanel(seedAlbums);

  JScrollPane scrollPane =
      new JScrollPane(
          albumGridPanel,
          JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.setBorder(UIHelper.NO_BORDER);
  return scrollPane;
}
 
Example 12
Source File: OrderByClausePanel.java    From bigtable-sql with Apache License 2.0 5 votes vote down vote up
/** Create the GUI elements for the panel */
private void createUserInterface()
{
       setLayout(new GridBagLayout());
       GridBagConstraints gbc;

       gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4,4,4,4),0,0);
       add(createControlsPanel(), gbc);

       _orderClauseArea.setLineWrap(true);
       JScrollPane sp = new JScrollPane(_orderClauseArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,	JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

       gbc = new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(4,4,4,4),0,0);
       add(sp, gbc);
}
 
Example 13
Source File: PropertiesDialog.java    From collect-earth with MIT License 4 votes vote down vote up
private JComponent getProjectsPanelScroll() {
	final JComponent projectsPanel = getProjectsPanel();
	return new JScrollPane(projectsPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
 
Example 14
Source File: HeaderPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    JTable impl = new JTable(new DefaultTableModel(new Object[] { "" }, 0)); // NOI18N
    TableColumnModel colMod = impl.getColumnModel();
    final TableColumn col = colMod.getColumn(0);
    impl.setFocusable(false);
    header = new Header(colMod);
    impl.setTableHeader(header);
    header.setResizingAllowed(false);
    header.setReorderingAllowed(false);

    final TableCellRenderer renderer = header.getDefaultRenderer();
    header.setDefaultRenderer(new TableCellRenderer() {
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {

            Component component = renderer.getTableCellRendererComponent(
                    table, getRendererValue(), isSelected(),
                    isSelected(), row, processMouseEvents() ? 0 : 1);

            setupRenderer(component);

            col.setWidth(header.getWidth());
            return component;
        }
    });

    JScrollPane scroll = new JScrollPane(impl, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        public Dimension getPreferredSize() { return header.getPreferredSize(); }
        public void reshape(int x, int y, int width, int height) {
            header.setPreferredSize(new Dimension(width, height));
            super.reshape(x, y, width, height);
        }
    };
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLayout(new OverlayLayout(this));
    add(scroll);
}
 
Example 15
Source File: AccountImportDialog.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public ExportPanel() {
	JLabel jHelp = new JLabel(DialoguesAccount.get().shareExportHelp() );

	jExportClipboard = new JButton(DialoguesAccount.get().shareExportClipboard(), Images.EDIT_COPY.getIcon());
	jExportClipboard.setActionCommand(AccountImportAction.SHARE_TO_CLIPBOARD.name());
	jExportClipboard.addActionListener(listener);

	jExportFile = new JButton(DialoguesAccount.get().shareExportFile(), Images.FILTER_SAVE.getIcon());
	jExportFile.setActionCommand(AccountImportAction.SHARE_TO_FILE.name());
	jExportFile.addActionListener(listener);

	jExport = new JTextArea();
	jExport.setFont(getFont());
	jExport.setEditable(false);
	jExport.setFocusable(true);
	jExport.setOpaque(false);
	jExport.setLineWrap(true);
	jExport.setWrapStyleWord(false);

	JScrollPane jScroll = new JScrollPane(jExport, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	jScroll.setBorder(BorderFactory.createLineBorder(this.getBackground().darker(), 1));

	cardLayout.setHorizontalGroup(
		cardLayout.createParallelGroup()
			.addComponent(jHelp)
			.addGroup(cardLayout.createSequentialGroup()
				.addComponent(jScroll)
				.addGroup(cardLayout.createParallelGroup()
					.addComponent(jExportClipboard, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
					.addComponent(jExportFile, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				)
			)
	);
	cardLayout.setVerticalGroup(
		cardLayout.createSequentialGroup()
			.addComponent(jHelp)
			.addGroup(cardLayout.createParallelGroup()
				.addComponent(jScroll)
				.addGroup(cardLayout.createSequentialGroup()
					.addComponent(jExportClipboard, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
					.addComponent(jExportFile, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				)
			)
	);
}
 
Example 16
Source File: PropertiesDialog.java    From collect-earth with MIT License 4 votes vote down vote up
private JScrollPane getOperationModePanelScroll() {
	final JComponent operationModePanel = getOperationModePanel();
	return new JScrollPane(operationModePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
 
Example 17
Source File: HeaderPanel.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private void initComponents() {
    JTable impl = new JTable(new DefaultTableModel(new Object[] { "" }, 0)); // NOI18N
    TableColumnModel colMod = impl.getColumnModel();
    final TableColumn col = colMod.getColumn(0);
    impl.setFocusable(false);
    header = new Header(colMod);
    impl.setTableHeader(header);
    header.setResizingAllowed(false);
    header.setReorderingAllowed(false);

    final TableCellRenderer renderer = header.getDefaultRenderer();
    header.setDefaultRenderer(new TableCellRenderer() {
        public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {

            Component component = renderer.getTableCellRendererComponent(
                    table, getRendererValue(), isSelected(),
                    isSelected(), row, processMouseEvents() ? 0 : 1);

            setupRenderer(component);

            col.setWidth(header.getWidth());
            return component;
        }
    });

    JScrollPane scroll = new JScrollPane(impl, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                               JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) {
        public Dimension getPreferredSize() { return header.getPreferredSize(); }
        public void reshape(int x, int y, int width, int height) {
            header.setPreferredSize(new Dimension(width, height));
            super.reshape(x, y, width, height);
        }
    };
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setViewportBorder(BorderFactory.createEmptyBorder());

    setLayout(new OverlayLayout(this));
    add(scroll);
}
 
Example 18
Source File: HelpTranslationDialog.java    From dualsub with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void initComponents() {
	// Features
	final int marginLeft = 30;
	this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	this.setResizable(false);
	getContentPane().setLayout(new BorderLayout());
	JPanel panel = new JPanel();
	panel.setLayout(null);
	panel.setPreferredSize(new Dimension(getWidth(), getHeight()));
	panel.setBackground(parent.getBackground());
	JScrollPane scroll = new JScrollPane(panel,
			JScrollPane.VERTICAL_SCROLLBAR_NEVER,
			JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	getContentPane().add(scroll);

	// Title
	final String title = I18N.getHtmlText("PanelTranslation.border.text");
	setTitle(I18N.getText("Window.name.text"));
	JLabel lblTitle = new JLabel(title);
	lblTitle.setFont(new Font("Lucida", Font.BOLD, 20));
	lblTitle.setBounds(marginLeft, 21, 435, 25);
	panel.add(lblTitle);

	// Content
	JLabel lblContent01 = new JLabel(
			I18N.getHtmlText("HelpTranslationDialog.help.01"));
	lblContent01.setBounds(marginLeft, 50, 435, 80);
	panel.add(lblContent01);

	JLabel lblContent02 = new JLabel(
			I18N.getHtmlText("HelpTranslationDialog.help.02"));
	lblContent02.setBounds(marginLeft, 130, 435, 140);
	panel.add(lblContent02);

	// Borders (for debug purposes)
	if (log.isTraceEnabled()) {
		Border border = BorderFactory.createLineBorder(Color.black);
		lblTitle.setBorder(border);
		lblContent01.setBorder(border);
		lblContent02.setBorder(border);
		panel.setBorder(border);
	}
}
 
Example 19
Source File: CommitsPanelProvider.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private JPanel initUpperPanel() {
  JPanel panel = new JPanel(new BorderLayout(20, 0));
  panel.setOpaque(false);
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  JPanel left = new JPanel(new FlowLayout(FlowLayout.LEADING));
  left.setOpaque(false);
  left.add(new JLabel(MessageUtils.getLocalizedMessage("commits.label.select_gen")));
  commitGenCombo.addActionListener(listeners::selectGeneration);
  left.add(commitGenCombo);
  panel.add(left, BorderLayout.LINE_START);

  JPanel right = new JPanel(new GridBagLayout());
  right.setOpaque(false);
  GridBagConstraints c1 = new GridBagConstraints();
  c1.ipadx = 5;
  c1.ipady = 5;

  c1.gridx = 0;
  c1.gridy = 0;
  c1.weightx = 0.2;
  c1.anchor = GridBagConstraints.EAST;
  right.add(new JLabel(MessageUtils.getLocalizedMessage("commits.label.deleted")), c1);

  c1.gridx = 1;
  c1.gridy = 0;
  c1.weightx = 0.5;
  c1.anchor = GridBagConstraints.WEST;
  right.add(deletedLbl, c1);

  c1.gridx = 0;
  c1.gridy = 1;
  c1.weightx = 0.2;
  c1.anchor = GridBagConstraints.EAST;
  right.add(new JLabel(MessageUtils.getLocalizedMessage("commits.label.segcount")), c1);

  c1.gridx = 1;
  c1.gridy = 1;
  c1.weightx = 0.5;
  c1.anchor = GridBagConstraints.WEST;
  right.add(segCntLbl, c1);

  c1.gridx = 0;
  c1.gridy = 2;
  c1.weightx = 0.2;
  c1.anchor = GridBagConstraints.EAST;
  right.add(new JLabel(MessageUtils.getLocalizedMessage("commits.label.userdata")), c1);

  userDataTA.setRows(3);
  userDataTA.setColumns(30);
  userDataTA.setLineWrap(true);
  userDataTA.setWrapStyleWord(true);
  userDataTA.setEditable(false);
  JScrollPane userDataScroll = new JScrollPane(userDataTA, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  c1.gridx = 1;
  c1.gridy = 2;
  c1.weightx = 0.5;
  c1.anchor = GridBagConstraints.WEST;
  right.add(userDataScroll, c1);

  panel.add(right, BorderLayout.CENTER);

  return panel;
}
 
Example 20
Source File: AccountImportDialog.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public ImportPanel() {
	JEditorPane jHelp = new JEditorPane("text/html", "<html><body style=\"font-family: " + getFont().getName() + "; font-size: " + getFont().getSize() + "pt\">"
		+ DialoguesAccount.get().shareImportHelp() + "</body></html>");
	((HTMLDocument) jHelp.getDocument()).getStyleSheet().addRule("body { font-family: " + getFont().getFamily() + "; " + "font-size: " + this.getFont().getSize() + "pt; }");
	jHelp.setFont(getFont());
	jHelp.setEditable(false);
	jHelp.setFocusable(false);
	jHelp.setOpaque(false);

	jImportClipboard = new JButton(DialoguesAccount.get().shareImportClipboard() , Images.EDIT_PASTE.getIcon());
	jImportClipboard.setActionCommand(AccountImportAction.SHARE_FROM_CLIPBOARD.name());
	jImportClipboard.addActionListener(listener);

	jImportFile= new JButton(DialoguesAccount.get().shareImportFile(), Images.FILTER_LOAD.getIcon());
	jImportFile.setActionCommand(AccountImportAction.SHARE_FROM_FILE.name());
	jImportFile.addActionListener(listener);

	jImport = new JTextArea();
	jImport.setFont(getFont());
	jImport.setEditable(true);
	jImport.setFocusable(true);
	jImport.setOpaque(true);
	jImport.setLineWrap(true);
	jImport.setWrapStyleWord(false);

	JScrollPane jScroll = new JScrollPane(jImport, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	jScroll.setBorder(BorderFactory.createLineBorder(this.getBackground().darker(), 1));

	cardLayout.setHorizontalGroup(
		cardLayout.createParallelGroup()
			.addComponent(jHelp)
			.addGroup(cardLayout.createSequentialGroup()
				.addComponent(jScroll)
				.addGroup(cardLayout.createParallelGroup()
					.addComponent(jImportClipboard, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
					.addComponent(jImportFile, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				)
			)
	);
	cardLayout.setVerticalGroup(
		cardLayout.createSequentialGroup()
			.addComponent(jHelp)
			.addGroup(cardLayout.createParallelGroup()
				.addComponent(jScroll)
				.addGroup(cardLayout.createSequentialGroup()
					.addComponent(jImportClipboard, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
					.addComponent(jImportFile, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				)
			)
	);
}