Java Code Examples for javax.swing.SwingConstants#BOTTOM
The following examples show how to use
javax.swing.SwingConstants#BOTTOM .
These examples are extracted from open source projects.
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 Project: netbeans File: ImagePanel.java License: Apache License 2.0 | 6 votes |
protected void paintComponent(Graphics graphics) { graphics.setColor(getBackground()); graphics.fillRect(0, 0, getWidth(), getHeight()); switch (imageAlign) { case (SwingConstants.TOP): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); break; case (SwingConstants.BOTTOM): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, getHeight() - image.getHeight(null), this); break; default: graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); } }
Example 2
Source Project: pdfxtk File: StyleEditor.java License: Apache License 2.0 | 6 votes |
private void setupUI(Style style) { size.getEditor().setItem(style.font.getSize() + ""); bold.setSelected((style.font.getStyle() & Font.BOLD) != 0); italic.setSelected((style.font.getStyle() & Font.ITALIC) != 0); selectFont(style.font.getFamily()); switch(style.vAlign) { case SwingConstants.TOP: anorth.setSelected(true); break; case SwingConstants.CENTER: acenterv.setSelected(true); break; case SwingConstants.BOTTOM: asouth.setSelected(true); break; } switch(style.hAlign) { case SwingConstants.LEFT: awest.setSelected(true); break; case SwingConstants.CENTER: acenterh.setSelected(true); break; case SwingConstants.RIGHT: aeast.setSelected(true); break; } }
Example 3
Source Project: visualvm File: ImagePanel.java License: GNU General Public License v2.0 | 6 votes |
protected void paintComponent(Graphics graphics) { graphics.setColor(getBackground()); graphics.fillRect(0, 0, getWidth(), getHeight()); switch (imageAlign) { case (SwingConstants.TOP): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); break; case (SwingConstants.BOTTOM): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, getHeight() - image.getHeight(null), this); break; default: graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); } }
Example 4
Source Project: pumpernickel File: BoxTabbedPaneUI.java License: MIT License | 6 votes |
protected GradientPaint createContentGradient(JComponent c, boolean isSelected) { JTabbedPane tabs = getTabbedPaneParent(c); int placement = tabs == null ? SwingConstants.TOP : tabs .getTabPlacement(); Color outer = isSelected ? contentOuterSelected : contentOuterNormal; Color inner = isSelected ? contentInnerSelected : contentInnerNormal; if (placement == SwingConstants.LEFT) { return (new GradientPaint(0, 0, outer, c.getWidth(), 0, inner)); } else if (placement == SwingConstants.RIGHT) { return (new GradientPaint(0, 0, inner, c.getWidth(), 0, outer)); } else if (placement == SwingConstants.BOTTOM) { return (new GradientPaint(0, 0, inner, 0, c.getHeight(), outer)); } else { return (new GradientPaint(0, 0, outer, 0, c.getHeight(), inner)); } }
Example 5
Source Project: pumpernickel File: BoxTabbedPaneUI.java License: MIT License | 6 votes |
@Override public void formatControlRow(JTabbedPane tabs, JPanel tabsContainer) { Border border; Paint paint = createBorderGradient(tabs.getTabPlacement()); if (tabs.getTabPlacement() == SwingConstants.BOTTOM) { border = new PartialLineBorder(paint, true, true, tabs.getTabCount() == 0, true); } else if (tabs.getTabPlacement() == SwingConstants.LEFT) { border = new PartialLineBorder(paint, true, tabs.getTabCount() == 0, true, true); } else if (tabs.getTabPlacement() == SwingConstants.RIGHT) { border = new PartialLineBorder(paint, true, true, true, tabs.getTabCount() == 0); } else { border = new PartialLineBorder(paint, tabs.getTabCount() == 0, true, true, true); } tabsContainer.setUI(new GradientPanelUI(createContentGradient(tabs, false))); tabsContainer.setBorder(border); }
Example 6
Source Project: pumpernickel File: BoxTabbedPaneUI.java License: MIT License | 6 votes |
@Override public void formatTabContent(JTabbedPane tabs, JComponent c) { if (contentBorder) { Border border; if (tabs.getTabPlacement() == SwingConstants.LEFT) { border = new PartialLineBorder(borderNormalDark, true, false, true, true); } else if (tabs.getTabPlacement() == SwingConstants.BOTTOM) { border = new PartialLineBorder(borderNormalDark, true, true, false, true); } else if (tabs.getTabPlacement() == SwingConstants.RIGHT) { border = new PartialLineBorder(borderNormalDark, true, true, true, false); } else { border = new PartialLineBorder(borderNormalDark, false, true, true, true); } c.setBorder(border); } }
Example 7
Source Project: FlatLaf File: FlatTableHeaderUI.java License: Apache License 2.0 | 5 votes |
@Override protected void installDefaults() { super.installDefaults(); separatorColor = UIManager.getColor( "TableHeader.separatorColor" ); bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" ); height = UIManager.getInt( "TableHeader.height" ); switch( Objects.toString( UIManager.getString( "TableHeader.sortIconPosition" ), "right" ) ) { default: case "right": sortIconPosition = SwingConstants.RIGHT; break; case "left": sortIconPosition = SwingConstants.LEFT; break; case "top": sortIconPosition = SwingConstants.TOP; break; case "bottom": sortIconPosition = SwingConstants.BOTTOM; break; } }
Example 8
Source Project: radiance File: TabOverviewButton.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Updates the location of <code>this</code> tab overview button. * * @param tabbedPane * Tabbed pane. * @param tabAreaInsets * Tab area insets. */ public void updateLocation(JTabbedPane tabbedPane, Insets tabAreaInsets) { if (tabbedPane == null) return; // Lock the button for the bounds change this.putClientProperty(TabOverviewButton.OWN_BOUNDS, Boolean.TRUE); int buttonSize = SubstanceSizeUtils.getLookupButtonSize(); switch (tabbedPane.getTabPlacement()) { case SwingConstants.TOP: if (tabbedPane.getComponentOrientation().isLeftToRight()) this.setBounds(2, tabAreaInsets.top, buttonSize, buttonSize); else this.setBounds(tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2, tabAreaInsets.top, buttonSize, buttonSize); break; case SwingConstants.BOTTOM: if (tabbedPane.getComponentOrientation().isLeftToRight()) this.setBounds(2, tabbedPane.getBounds().height - tabAreaInsets.bottom - buttonSize - 4, buttonSize, buttonSize); else this.setBounds(tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2, tabbedPane.getBounds().height - tabAreaInsets.bottom - buttonSize - 4, buttonSize, buttonSize); break; case SwingConstants.LEFT: this.setBounds(2, tabAreaInsets.top - 1, buttonSize, buttonSize); break; case SwingConstants.RIGHT: this.setBounds(tabbedPane.getBounds().width - tabAreaInsets.right - buttonSize - 2, tabAreaInsets.top - 1, buttonSize, buttonSize); break; } // Unlock the button for the bounds change this.putClientProperty(TabOverviewButton.OWN_BOUNDS, null); }
Example 9
Source Project: stendhal File: SwingClientGUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Create the left side panel of the client. * * @return A component containing the components left of the game screen */ private JComponent createLeftPanel(StendhalClient client) { minimap = new MapPanelController(client); final StatsPanelController stats = StatsPanelController.get(); final BuddyPanelController buddies = BuddyPanelController.get(); ScrolledViewport buddyScroll = new ScrolledViewport((JComponent) buddies.getComponent()); buddyScroll.setScrollingSpeed(SCROLLING_SPEED); final JComponent buddyPane = buddyScroll.getComponent(); buddyPane.setBorder(null); final JComponent leftColumn = SBoxLayout.createContainer(SBoxLayout.VERTICAL); leftColumn.add(minimap.getComponent(), SLayout.EXPAND_X); leftColumn.add(stats.getComponent(), SLayout.EXPAND_X); // Add a background for the tabs. The column itself has none. JPanel tabBackground = new JPanel(); tabBackground.setBorder(null); tabBackground.setLayout(new SBoxLayout(SBoxLayout.VERTICAL)); JTabbedPane tabs = new JTabbedPane(SwingConstants.BOTTOM); // Adjust the Tab Width, if we can. The default is pretty if there's // space, but in the column there are no pixels to waste. TabbedPaneUI ui = tabs.getUI(); if (ui instanceof StyledTabbedPaneUI) { ((StyledTabbedPaneUI) ui).setTabLabelMargins(1); } tabs.setFocusable(false); tabs.add("Friends", buddyPane); tabs.add("Group", GroupPanelController.get().getComponent()); tabBackground.add(tabs, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y)); leftColumn.add(tabBackground, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y)); return leftColumn; }
Example 10
Source Project: mars-sim File: AbstractRadial.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final Rectangle BOUNDS) { if (BOUNDS.width <= BOUNDS.height) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = BOUNDS.y; break; case SwingConstants.BOTTOM: yNew = BOUNDS.y + (BOUNDS.height - BOUNDS.width); break; case SwingConstants.CENTER: default: yNew = BOUNDS.y + ((BOUNDS.height - BOUNDS.width) / 2); break; } super.setBounds(BOUNDS.x, yNew, BOUNDS.width, BOUNDS.width); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = BOUNDS.x; break; case SwingConstants.RIGHT: xNew = BOUNDS.x + (BOUNDS.width - BOUNDS.height); break; case SwingConstants.CENTER: default: xNew = BOUNDS.x + ((BOUNDS.width - BOUNDS.height) / 2); break; } super.setBounds(xNew, BOUNDS.y, BOUNDS.height, BOUNDS.height); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
Example 11
Source Project: pumpernickel File: BoxTabbedPaneUI.java License: MIT License | 5 votes |
private GradientPaint createBorderGradient(int tabPlacement) { if (tabPlacement == SwingConstants.BOTTOM) { return new GradientPaint(0, 0, borderNormalDark, 0, 25, borderNormalLight); } else if (tabPlacement == SwingConstants.LEFT) { return new GradientPaint(0, 0, borderNormalLight, 25, 0, borderNormalDark); } else if (tabPlacement == SwingConstants.RIGHT) { return new GradientPaint(0, 0, borderNormalDark, 25, 0, borderNormalLight); } else { return new GradientPaint(0, 0, borderNormalLight, 0, 25, borderNormalDark); } }
Example 12
Source Project: mars-sim File: LightBulb.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final Rectangle BOUNDS) { if (BOUNDS.width <= BOUNDS.height) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = BOUNDS.y; break; case SwingConstants.BOTTOM: yNew = BOUNDS.y + (BOUNDS.height - BOUNDS.width); break; case SwingConstants.CENTER: default: yNew = BOUNDS.y + ((BOUNDS.height - BOUNDS.width) / 2); break; } super.setBounds(BOUNDS.x, yNew, BOUNDS.width, BOUNDS.width); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = BOUNDS.x; break; case SwingConstants.RIGHT: xNew = BOUNDS.x + (BOUNDS.width - BOUNDS.height); break; case SwingConstants.CENTER: default: xNew = BOUNDS.x + ((BOUNDS.width - BOUNDS.height) / 2); break; } super.setBounds(xNew, BOUNDS.y, BOUNDS.height, BOUNDS.height); } calcInnerBounds(); init(INNER_BOUNDS.width, INNER_BOUNDS.height); }
Example 13
Source Project: mars-sim File: LightBulb.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { if (WIDTH <= HEIGHT) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = Y; break; case SwingConstants.BOTTOM: yNew = Y + (HEIGHT - WIDTH); break; case SwingConstants.CENTER: default: yNew = Y + ((HEIGHT - WIDTH) / 2); break; } super.setBounds(X, yNew, WIDTH, WIDTH); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = X; break; case SwingConstants.RIGHT: xNew = X + (WIDTH - HEIGHT); break; case SwingConstants.CENTER: default: xNew = X + ((WIDTH - HEIGHT) / 2); break; } super.setBounds(xNew, Y, HEIGHT, HEIGHT); } calcInnerBounds(); init(INNER_BOUNDS.width, INNER_BOUNDS.height); }
Example 14
Source Project: mars-sim File: Clock.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final Rectangle BOUNDS) { if (BOUNDS.width <= BOUNDS.height) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = BOUNDS.y; break; case SwingConstants.BOTTOM: yNew = BOUNDS.y + (BOUNDS.height - BOUNDS.width); break; case SwingConstants.CENTER: default: yNew = BOUNDS.y + ((BOUNDS.height - BOUNDS.width) / 2); break; } super.setBounds(BOUNDS.x, yNew, BOUNDS.width, BOUNDS.width); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = BOUNDS.x; break; case SwingConstants.RIGHT: xNew = BOUNDS.x + (BOUNDS.width - BOUNDS.height); break; case SwingConstants.CENTER: default: xNew = BOUNDS.x + ((BOUNDS.width - BOUNDS.height) / 2); break; } super.setBounds(xNew, BOUNDS.y, BOUNDS.height, BOUNDS.height); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
Example 15
Source Project: mars-sim File: Clock.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { if (WIDTH <= HEIGHT) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = Y; break; case SwingConstants.BOTTOM: yNew = Y + (HEIGHT - WIDTH); break; case SwingConstants.CENTER: default: yNew = Y + ((HEIGHT - WIDTH) / 2); break; } super.setBounds(X, yNew, WIDTH, WIDTH); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = X; break; case SwingConstants.RIGHT: xNew = X + (WIDTH - HEIGHT); break; case SwingConstants.CENTER: default: xNew = X + ((WIDTH - HEIGHT) / 2); break; } super.setBounds(xNew, Y, HEIGHT, HEIGHT); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
Example 16
Source Project: mars-sim File: Led.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { if (WIDTH <= HEIGHT) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = Y; break; case SwingConstants.BOTTOM: yNew = Y + (HEIGHT - WIDTH); break; case SwingConstants.CENTER: default: yNew = Y + ((HEIGHT - WIDTH) / 2); break; } super.setBounds(X, yNew, WIDTH, WIDTH); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = X; break; case SwingConstants.RIGHT: xNew = X + (WIDTH - HEIGHT); break; case SwingConstants.CENTER: default: xNew = X + ((WIDTH - HEIGHT) / 2); break; } super.setBounds(xNew, Y, HEIGHT, HEIGHT); } calcInnerBounds(); init(INNER_BOUNDS.width); initialized = true; }
Example 17
Source Project: mars-sim File: StopWatch.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final Rectangle BOUNDS) { if (BOUNDS.width <= BOUNDS.height) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = BOUNDS.y; break; case SwingConstants.BOTTOM: yNew = BOUNDS.y + (BOUNDS.height - BOUNDS.width); break; case SwingConstants.CENTER: default: yNew = BOUNDS.y + ((BOUNDS.height - BOUNDS.width) / 2); break; } super.setBounds(BOUNDS.x, yNew, BOUNDS.width, BOUNDS.width); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = BOUNDS.x; break; case SwingConstants.RIGHT: xNew = BOUNDS.x + (BOUNDS.width - BOUNDS.height); break; case SwingConstants.CENTER: default: xNew = BOUNDS.x + ((BOUNDS.width - BOUNDS.height) / 2); break; } super.setBounds(xNew, BOUNDS.y, BOUNDS.height, BOUNDS.height); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
Example 18
Source Project: mars-sim File: AbstractRadial.java License: GNU General Public License v3.0 | 5 votes |
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { if (WIDTH <= HEIGHT) { // vertical int yNew; switch(verticalAlignment) { case SwingConstants.TOP: yNew = Y; break; case SwingConstants.BOTTOM: yNew = Y + (HEIGHT - WIDTH); break; case SwingConstants.CENTER: default: yNew = Y + ((HEIGHT - WIDTH) / 2); break; } super.setBounds(X, yNew, WIDTH, WIDTH); } else { // horizontal int xNew; switch(horizontalAlignment) { case SwingConstants.LEFT: xNew = X; break; case SwingConstants.RIGHT: xNew = X + (WIDTH - HEIGHT); break; case SwingConstants.CENTER: default: xNew = X + ((WIDTH - HEIGHT) / 2); break; } super.setBounds(xNew, Y, HEIGHT, HEIGHT); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
Example 19
Source Project: desktopclient-java File: MainFrame.java License: GNU General Public License v3.0 | 4 votes |
private static WebPanel createListPanel(final WebTable list, String overlayText, WebToggleButton button) { // overlay for empty list WebOverlay listOverlay = new WebOverlay(list); listOverlay.setOverlayMargin(20); final WebTextArea overlayArea = new WebTextArea(); overlayArea.setText(overlayText); overlayArea.setLineWrap(true); overlayArea.setWrapStyleWord(true); overlayArea.setMargin(View.MARGIN_DEFAULT); overlayArea.setFontSize(View.FONT_SIZE_BIG); overlayArea.setEditable(false); BorderPainter<WebTextArea> borderPainter = new BorderPainter<>(Color.LIGHT_GRAY); borderPainter.setRound(15); overlayArea.setPainter(borderPainter); list.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { overlayArea.setVisible(list.getModel().getRowCount() == 0); } }); overlayArea.setVisible(list.getModel().getRowCount() == 0); listOverlay.addOverlay(overlayArea, SwingConstants.CENTER, SwingConstants.CENTER); WebScrollPane scrollPane = new ComponentUtils.ScrollPane(listOverlay); scrollPane.setDrawBorder(false); // button as overlay button.setOpaque(false); button.setUndecorated(true); WebOverlay chatListOverlay = new WebOverlay(scrollPane, button, SwingConstants.TRAILING, SwingConstants.BOTTOM); chatListOverlay.setOverlayMargin(0, 0, View.GAP_BIG, View.GAP_BIG + SCROLL_BAR_WIDTH); // fixing overlay button paint bug on startup, dont wanna know whats happening here SwingUtils.delayInvokeLater(0, new Runnable() { @Override public void run() { TooltipManager.showOneTimeTooltip(list, new Point(1,1), ""); } }); return chatListOverlay; }
Example 20
Source Project: pdfxtk File: StyleEditor.java License: Apache License 2.0 | 4 votes |
static boolean validVerticalKey(int key) { return ((key == SwingConstants.TOP) || (key == SwingConstants.CENTER) || (key == SwingConstants.BOTTOM)); }