Refine search
/** * Adds the given JComponent as a decoration on the right of the title * @param decoration */ @Override public void setRightDecoration(JComponent decoration) { if (right != null) topPanel.remove(right); right = decoration; if (right != null) { topPanel.add(decoration, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, UIManager.getInsets("JXTitledPanel.rightDecorationInsets"), 0, 0)); } }
protected JXPanel createAndConfigureTopPanel(JXTitledPanel titledPanel) { JXPanel topPanel = new JXPanel(); topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.setBorder(BorderFactory.createEmptyBorder()); topPanel.setLayout(new GridBagLayout()); topPanel.setOpaque(false); return topPanel; }
protected void paintComponentPatch(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { if (isPaintingBackground()) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } if (getBackgroundPainter() != null) { getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } fakeTransparent = true; getUI().update(g2, this); } finally { g2.dispose(); fakeTransparent = false; } }
public static JXPanel getDescription(CardView card, int width, int height) { JXPanel descriptionPanel = new JXPanel(); //descriptionPanel.setAlpha(.8f); descriptionPanel.setBounds(0, 0, width, height); descriptionPanel.setVisible(false); descriptionPanel.setLayout(null); //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green)); JButton j = new JButton(""); j.setBounds(0, 0, width, height); j.setBackground(Color.black); j.setLayout(null); JLabel cardText = new JLabel(); cardText.setBounds(5, 5, width - 10, height - 10); cardText.setForeground(Color.white); cardText.setFont(cardNameFont); cardText.setVerticalAlignment(SwingConstants.TOP); j.add(cardText); TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card); cardText.setText(getRulefromCardView(card, textLines).toString()); descriptionPanel.add(j); return descriptionPanel; }
/** * Sets a Painter to use to paint the background of this JXPanel. * * @param p the new painter * @see #getBackgroundPainter() */ public void setBackgroundPainter(Painter p) { Painter old = getBackgroundPainter(); backgroundPainter = p; firePropertyChange("backgroundPainter", old, getBackgroundPainter()); repaint(); }
public Container getContentContainer() { if (contentPanel == null) { contentPanel = new JXPanel(); ((JXPanel) contentPanel).setBorder(BorderFactory .createEmptyBorder()); this.add(contentPanel, BorderLayout.CENTER); } return contentPanel; }
/** * Recreates the login panel, and replaces the current one with the new one */ protected void recreateLoginPanel() { JXPanel old = loginPanel; loginPanel = createLoginPanel(); loginPanel.setBorder(BorderFactory.createEmptyBorder(0, 36, 7, 11)); contentPanel.remove(old); contentPanel.add(loginPanel, 1); }
protected void installComponents(JXTitledPanel titledPanel) { topPanel.add(caption, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, getCaptionInsets(), 0, 0)); if (titledPanel.getClientProperty(JXTitledPanel.RIGHT_DECORATION) instanceof JComponent) { setRightDecoration((JComponent) titledPanel.getClientProperty(JXTitledPanel.RIGHT_DECORATION)); } if (titledPanel.getClientProperty(JXTitledPanel.LEFT_DECORATION) instanceof JComponent) { setLeftDecoration((JComponent) titledPanel.getClientProperty(JXTitledPanel.LEFT_DECORATION)); } // swingx#500 if (!(titledPanel.getLayout() instanceof BorderLayout)){ titledPanel.setLayout(new BorderLayout()); } titledPanel.add(topPanel, BorderLayout.NORTH); // fix #1063-swingx: must respect custom border if (SwingXUtilities.isUIInstallable(titledPanel.getBorder())) { // use uiresource border // old was: BorderFactory.createRaisedBevelBorder()); titledPanel.setBorder(BorderUIResource.getRaisedBevelBorderUIResource()); } }
JTextField name = new JTextField(20); name.setOpaque(false); JTextField pass = new JTextField(20); pass.setOpaque(false); pass.setForeground(Color.WHITE); // being lazy: use SwingX JXPanel panel = new JXPanel(); BufferedImage back = XTestUtils.loadDefaultImage("moon.jpg"); panel.setBackgroundPainter(new ImagePainter(back)); panel.add(name); panel.add(pass);
@Override public void actionPerformed(ActionEvent e) { JXPanel panel = new JXPanel(new MigLayout("wrap 2")); panel.add(new JLabel(NbBundle.getMessage(AreaFieldModule.class, "action.mark_all_shapes_as.dialog.label.choose_shape"))); panel.add(comboBox); DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(AreaFieldModule.class, "action.mark_all_shapes_as.dialog.title")); dd.setOptions(new Object[]{getOkButton(), getCancelButton()}); dlg = DialogDisplayer.getDefault().createDialog(dd); dlg.setVisible(true); }
/** * Sets a Painter to use to paint the background of this JXPanel. * * @param p the new painter * @see #getBackgroundPainter() */ @Override public void setBackgroundPainter(Painter p) { Painter old = getBackgroundPainter(); if (old instanceof AbstractPainter) { ((AbstractPainter<?>) old).removePropertyChangeListener(painterChangeListener); } backgroundPainter = p; if (backgroundPainter instanceof AbstractPainter) { ((AbstractPainter<?>) backgroundPainter).addPropertyChangeListener(getPainterChangeListener()); } firePropertyChange("backgroundPainter", old, getBackgroundPainter()); repaint(); }
public DrawingController(JXMapViewer mapPanel) { this.drawingPanel = new DrawingPanel(mapPanel); this.toolsPanel = new JXPanel(); toolsPanel.setOpaque(false); toolsPanel.setLayout(new BorderLayout()); drawingPanel.addNodeListener(rootNodeListener); // listen for edit requests: GuiEventBus.addListener(editLayerEventListener); GuiEventBus.addListener(splitLayerEventListener); //measure GuiEventBus.addListener(measureLengthEventListener); GuiEventBus.addListener(measureAreaEventListener); }
assert super.getComponent(0) == wrapper; super.remove(0); super.addImpl(wrapper, BorderLayout.CENTER, -1);
JXPanel panel = new JXPanel(); ImagePainter image = new ImagePainter(myImage); image.setFilters( new AffineTransformOp(AffineTransform.getRotateInstance(-Math.PI * 2 / 8, 100, 100), null) ); panel.setBackgroundPainter(image);
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("title")) { caption.setText((String)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleForeground")) { caption.setForeground((Color)evt.getNewValue()); } else if (evt.getPropertyName().equals("titleFont")) { caption.setFont((Font)evt.getNewValue()); } else if ("titlePainter".equals(evt.getPropertyName())) { topPanel.setBackgroundPainter(titledPanel.getTitlePainter()); topPanel.repaint(); } } };
/** * {@inheritDoc} */ @Override public float getEffectiveAlpha() { float a = getAlpha(); if (isInheritAlpha()) { for (Component c = getParent(); c != null; c = c.getParent()) { if (c instanceof AlphaPaintable) { a = Math.min(((AlphaPaintable) c).getEffectiveAlpha(), a); break; } } } return a; }
/** * Constructs a new JXCollapsiblePane with a {@link JPanel} as content pane * and the given LayoutManager and orientation. A vertical orientation * enables a vertical {@link VerticalLayout} with a gap of 2 pixels as * layout manager. A horizontal orientation enables a horizontal * {@link HorizontalLayout} with a gap of 2 pixels as layout manager * * @param direction * the direction this pane collapses * @param layout * of this collapsible pane */ public JXCollapsiblePane(Direction direction, LayoutManager layout) { super.setLayout(layout); this.direction = direction; animator = new AnimationListener(); setAnimationParams(new AnimationParams(30, 8, 0.01f, 1.0f)); JXPanel panel = new JXPanel(); setContentPane(panel); setDirection(direction); // add an action to automatically toggle the state of the pane getActionMap().put(TOGGLE_ACTION, new ToggleAction()); }
/** * Updates the legend Adds all the Legend colors and descriptions to the * legend */ void updateLegend() { if (currentlyShowing != null && !currentlyShowing.isEmpty()) { legendColorPanel.removeAll(); for (LegendPalette.Entry legendColor : currentlyShowing.iterator().next().getEntries()) { JLabel colorLabel = new JLabel("#"); colorLabel.setBackground(legendColor.getColor()); colorLabel.setForeground(legendColor.getColor()); colorLabel.setPreferredSize(COLOR_BLOCK_DIMENSION); legendColorPanel.add(colorLabel); legendColorPanel.add(new JLabel(legendColor.getDescription())); } repaint(); revalidate(); } }
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(new Color(187, 187, 187)); g.drawLine(0, 0, getWidth(), 0); g.setColor(new Color(221, 221, 221)); g.drawLine(0, 1, getWidth(), 1); }