Java Code Examples for javax.swing.JSeparator#VERTICAL
The following examples show how to use
javax.swing.JSeparator#VERTICAL .
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: FlatSeparatorUI.java From FlatLaf with Apache License 2.0 | 6 votes |
@Override public void paint( Graphics g, JComponent c ) { Graphics2D g2 = (Graphics2D) g.create(); try { FlatUIUtils.setRenderingHints( g2 ); g2.setColor( c.getForeground() ); float width = scale( (float) stripeWidth ); float indent = scale( (float) stripeIndent ); if( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) g2.fill( new Rectangle2D.Float( indent, 0, width, c.getHeight() ) ); else g2.fill( new Rectangle2D.Float( 0, indent, c.getWidth(), width ) ); } finally { g2.dispose(); } }
Example 2
Source File: GenericToolbar.java From netbeans with Apache License 2.0 | 6 votes |
public void addSeparator() { if (!UIUtils.isMetalLookAndFeel()) { super.addSeparator(); } else { final JSeparator separator = new JSeparator(JSeparator.VERTICAL); final int WDTH = separator.getPreferredSize().width; final Dimension SIZE = new Dimension(new JToolBar.Separator().getSeparatorSize().width, 12); JPanel panel = new JPanel(null) { public Dimension getPreferredSize() { return SIZE; } public Dimension getMaximumSize() { return SIZE; } public Dimension getMinimumSize() { return SIZE; } public void doLayout() { int x = (getWidth() - WDTH) / 2; int y = (getHeight()- SIZE.height) / 2; separator.setBounds(x, y, WDTH, SIZE.height); } }; panel.setOpaque(false); panel.add(separator); super.add(panel); } }
Example 3
Source File: GenericToolbar.java From visualvm with GNU General Public License v2.0 | 6 votes |
public void addSeparator() { if (!UIUtils.isMetalLookAndFeel()) { super.addSeparator(); } else { final JSeparator separator = new JSeparator(JSeparator.VERTICAL); final int WDTH = separator.getPreferredSize().width; final Dimension SIZE = new Dimension(new JToolBar.Separator().getSeparatorSize().width, 12); JPanel panel = new JPanel(null) { public Dimension getPreferredSize() { return SIZE; } public Dimension getMaximumSize() { return SIZE; } public Dimension getMinimumSize() { return SIZE; } public void doLayout() { int x = (getWidth() - WDTH) / 2; int y = (getHeight()- SIZE.height) / 2; separator.setBounds(x, y, WDTH, SIZE.height); } }; panel.setOpaque(false); panel.add(separator); super.add(panel); } }
Example 4
Source File: BetaFeaturesIndicator.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates a indicator for activation of beta features. */ BetaFeaturesIndicator() { separator = new JSeparator(JSeparator.VERTICAL); modeLabel = new ResourceLabel("setting.activated_beta_features"); modeLabel.setFont(modeLabel.getFont().deriveFont(Font.BOLD)); modeLabel.setForeground(ICON_COLOR); modeLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { showBetaBubble(); } }); ParameterService.registerParameterChangeListener(betaFeaturesListener); if (Boolean.parseBoolean(ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_UPDATE_BETA_FEATURES))) { modeLabel.setVisible(true); separator.setVisible(true); } else { modeLabel.setVisible(false); separator.setVisible(false); } }
Example 5
Source File: BEPopupMenuSeparatorUI.java From beautyeye with Apache License 2.0 | 6 votes |
public void paint( Graphics g, JComponent c ) { int w = c.getWidth(),h = c.getHeight(); Graphics2D g2 = (Graphics2D)g; if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) { //垂直坚线原始代码 //TODO 垂直样式的竖线有时间再实现吧,垂直竖线默认用于JToolBar里 g.setColor( c.getForeground() ); g.drawLine( 0, 0, 0, c.getHeight() ); g.setColor( c.getBackground() ); g.drawLine( 1, 0, 1, c.getHeight() ); } else // HORIZONTAL { drawHorizonal(g2,c,w,h); } }
Example 6
Source File: FlatSeparatorUI.java From FlatLaf with Apache License 2.0 | 5 votes |
@Override public Dimension getPreferredSize( JComponent c ) { if( ((JSeparator) c).getOrientation() == JSeparator.VERTICAL ) return new Dimension( scale( height ), 0 ); else return new Dimension( 0, scale( height ) ); }
Example 7
Source File: BEPopupMenuSeparatorUI.java From beautyeye with Apache License 2.0 | 5 votes |
public Dimension getPreferredSize( JComponent c ) { if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) return new Dimension( 2, 0 ); else return new Dimension( 0, 3 ); }
Example 8
Source File: BESeparatorUI.java From beautyeye with Apache License 2.0 | 5 votes |
@Override public void paint( Graphics g, JComponent c ) { //** 绘制border的底线 //虚线样式 Stroke oldStroke = ((Graphics2D)g).getStroke(); Stroke sroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{2, 2}, 0);//实线,空白 ((Graphics2D)g).setStroke(sroke);// // super.paint(g, c); Dimension s = c.getSize(); if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL ) { // System.out.println("c.getBackground()c.getBackground()c.getBackground()="+c.getBackground()); g.setColor( c.getForeground() ); g.drawLine( 0, 0, 0, s.height ); g.setColor( c.getBackground() ); g.drawLine( 1, 0, 1, s.height ); } else // HORIZONTAL { g.setColor( c.getForeground() ); g.drawLine( 0, 0, s.width, 0 ); g.setColor( c.getBackground() ); g.drawLine( 0, 1, s.width, 1 ); } ((Graphics2D)g).setStroke(oldStroke); }
Example 9
Source File: StatusLineComponent.java From netbeans with Apache License 2.0 | 4 votes |
private void createSeparator() { discardSeparator(); separator = new JSeparator(JSeparator.VERTICAL); // separator.setPreferredSize(new Dimension(5, prefferedHeight)); separator.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, 0)); }
Example 10
Source File: SearchPanelProvider.java From lucene-solr with Apache License 2.0 | 4 votes |
private JPanel initSearchResultsHeaderPane() { JPanel panel = new JPanel(new GridLayout(1, 2)); panel.setOpaque(false); JLabel label = new JLabel(FontUtils.elegantIconHtml("", MessageUtils.getLocalizedMessage("search.label.results"))); label.setHorizontalTextPosition(JLabel.LEFT); label.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)); panel.add(label); JPanel resultsInfo = new JPanel(new FlowLayout(FlowLayout.TRAILING)); resultsInfo.setOpaque(false); resultsInfo.setOpaque(false); JLabel totalLabel = new JLabel(MessageUtils.getLocalizedMessage("search.label.total")); resultsInfo.add(totalLabel); totalHitsLbl.setText("?"); resultsInfo.add(totalHitsLbl); prevBtn.setText(FontUtils.elegantIconHtml("D")); prevBtn.setMargin(new Insets(5, 0, 5, 0)); prevBtn.setPreferredSize(new Dimension(30, 20)); prevBtn.setEnabled(false); prevBtn.addActionListener(listeners::prevPage); resultsInfo.add(prevBtn); startLbl.setText("0"); resultsInfo.add(startLbl); resultsInfo.add(new JLabel(" ~ ")); endLbl.setText("0"); resultsInfo.add(endLbl); nextBtn.setText(FontUtils.elegantIconHtml("E")); nextBtn.setMargin(new Insets(3, 0, 3, 0)); nextBtn.setPreferredSize(new Dimension(30, 20)); nextBtn.setEnabled(false); nextBtn.addActionListener(listeners::nextPage); resultsInfo.add(nextBtn); JSeparator sep = new JSeparator(JSeparator.VERTICAL); sep.setPreferredSize(new Dimension(5, 1)); resultsInfo.add(sep); delBtn.setText(FontUtils.elegantIconHtml("", MessageUtils.getLocalizedMessage("search.button.del_all"))); delBtn.setMargin(new Insets(5, 0, 5, 0)); delBtn.setEnabled(false); delBtn.addActionListener(listeners::confirmDeletion); resultsInfo.add(delBtn); panel.add(resultsInfo, BorderLayout.CENTER); return panel; }
Example 11
Source File: ResultView.java From Raccoon with Apache License 2.0 | 4 votes |
/** * Construct a new app listing * * @param searchView * the searchview that will handle button presses. * * @param doc * the source from which to draw app info */ private ResultView(SearchView searchView, DocV2 doc) { this.doc = doc; this.searchView = searchView; model = new HashMap<String, Object>(); model.put("i18n_installs", Messages.getString("ResultView.1")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_rating", Messages.getString("ResultView.3")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_price", Messages.getString("ResultView.5")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_date", Messages.getString("ResultView.7")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_version", Messages.getString("ResultView.2")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_size", Messages.getString("ResultView.9")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_permissions", Messages.getString("ResultView.27")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_permissions_none", Messages.getString("ResultView.22")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("i18n_changelog", Messages.getString("ResultView.4")); //$NON-NLS-1$ //$NON-NLS-2$ model.put("title", doc.getTitle()); //$NON-NLS-1$ model.put("installs", doc.getDetails().getAppDetails().getNumDownloads()); //$NON-NLS-1$ model.put("rating", String.format("%.2f", doc.getAggregateRating().getStarRating())); //$NON-NLS-1$ //$NON-NLS-2$ model.put("package", doc.getBackendDocid()); //$NON-NLS-1$ model.put("author", doc.getCreator()); //$NON-NLS-1$ model.put("price", doc.getOffer(0).getFormattedAmount()); //$NON-NLS-1$ model.put("date", doc.getDetails().getAppDetails().getUploadDate()); //$NON-NLS-1$ model.put("size", Archive.humanReadableByteCount(doc.getDetails().getAppDetails() //$NON-NLS-1$ .getInstallationSize(), true)); File icon = SearchWorker.getImageCacheFile(doc.getBackendDocid(), 4); if (icon.exists()) { model.put("icon", icon.toURI()); //$NON-NLS-1$ } else { model.put("icon", getClass().getResource("/rsrc/icons/icon_missing.png").toString()); } JPanel buttons = new JPanel(); buttons.setLayout(new GridLayout(0, 1, 0, 4)); buttons.setOpaque(false); download = new JButton(Messages.getString("ResultView.25"), iconDownload); //$NON-NLS-1$ gplay = new JButton(Messages.getString("ResultView.26")); //$NON-NLS-1$ details = new JToggleButton(Messages.getString("ResultView.6")); //$NON-NLS-1$ permissions = new JToggleButton(Messages.getString("ResultView.27")); //$NON-NLS-1$ buttons.add(download); buttons.add(gplay); buttons.add(details); buttons.add(permissions); entry = new HypertextPane(TmplTool.transform("app.html", model)); //$NON-NLS-1$ entry.setMargin(new Insets(10, 10, 10, 10)); entry.addHyperlinkListener(new BrowseUtil()); // Keep enclosing scrollpanes steady DefaultCaret caret = (DefaultCaret) entry.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); JPanel outer = new JPanel(); // Needed to simplify the layout code. outer.setOpaque(false); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); container.setOpaque(false); container.add(buttons); container.add(Box.createVerticalStrut(10)); container.add(createBadges(doc.getDetails().getAppDetails().getPermissionList())); container.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); outer.add(container); JSeparator sep = new JSeparator(JSeparator.VERTICAL); sep.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(outer); add(sep); add(entry); }