public void refreshPanel() { criteriaListPanel.removeAll(); criteriaList.clear(); criteriaListPanel.revalidate(); criteriaListPanel.repaint(); setHeadersEnabled(false); }
public void changeData(byte[] bytes) { if (mainPane.getComponentCount() > 0) { mainPane.removeAll(); } HexModel model = new HexModel(bytes); mainPane.add(new HexEditor(model)); mainPane.validate(); }
private static void processSideBars(Map sideBars, JComponent ec) { JScrollPane scroller = (JScrollPane) ec.getComponent(0); // Remove all existing sidebars ec.removeAll(); // Add the scroller and the new sidebars ec.add(scroller); scroller.setRowHeader(null); scroller.setColumnHeaderView(null); // final MouseDispatcher mouse = new MouseDispatcher((JTextComponent) // ec.getClientProperty(JTextComponent.class)); for (Iterator entries = sideBars.entrySet().iterator(); entries.hasNext(); ) { Map.Entry entry = (Map.Entry) entries.next(); SideBarPosition position = (SideBarPosition) entry.getKey(); JComponent sideBar = (JComponent) entry.getValue(); // if (position.getPosition() == SideBarPosition.WEST) { // JPanel p = new JPanel(new BorderLayout()) { // // @Override // public void addNotify() { // super.addNotify(); // infiltrateContainer(this, mouse, true); // } // // @Override // public void removeNotify() { // infiltrateContainer(this, mouse, false); // super.removeNotify(); // } // // }; // p.add(sideBar, BorderLayout.CENTER); // sideBar = p; // } if (position.isScrollable()) { if (position.getPosition() == SideBarPosition.WEST) { scroller.setRowHeaderView(sideBar); } else { if (position.getPosition() == SideBarPosition.NORTH) { scroller.setColumnHeaderView(sideBar); } else { throw new IllegalArgumentException( "Unsupported side bar position, scrollable = true, position=" + position.getBorderLayoutPosition()); // NOI18N } } } else { ec.add(sideBar, position.getBorderLayoutPosition()); } } }
public void update() { // remove all buttons container.removeAll(); // number of indicators int count = IndicatorPanel.this.chartFrame.getSplitPanel().getIndicatorsPanel().getIndicatorsCount(); ToolboxButton button; // Settings container.add( button = new ToolboxButton( indicatorSettings(IndicatorPanel.this.chartFrame, IndicatorPanel.this))); button.setText(""); button.setToolTipText("Settings"); if (count > 1) { // Move Up container.add( button = new ToolboxButton(moveUp(IndicatorPanel.this.chartFrame, IndicatorPanel.this))); button.setText(""); button.setToolTipText("Move Up"); // Move Down container.add( button = new ToolboxButton(moveDown(IndicatorPanel.this.chartFrame, IndicatorPanel.this))); button.setText(""); button.setToolTipText("Move Down"); } // Toggle Maximize/Minimize container.add( button = new ToolboxButton( isMaximized() ? minimize(IndicatorPanel.this) : maximize(IndicatorPanel.this))); button.setText(""); button.setToolTipText(isMaximized() ? "Minimize" : "Maximize"); // Remove container.add( button = new ToolboxButton(removeAction(IndicatorPanel.this.chartFrame, IndicatorPanel.this))); button.setText(""); button.setToolTipText("Remove"); revalidate(); repaint(); }
/** * Selects the canvas at the specified index. If the index is out of bounds, perform no action. * * @param index - the index of the canvas to be viewed. * @requires none (INDEX DOES NOT HAVE TO BE WITHIN BOUNDS) */ public void selectCanvas(int index) { if (index >= 0 && index < drawerCards.size()) { TabCard card = drawerCards.get(index); canvasPane.removeAll(); canvasPane.add(card.getScroll()); canvasPane.revalidate(); canvasPane.repaint(); for (TabCard otherCard : drawerCards) { otherCard.getButton().toggleSelected(false); } card.getButton().toggleSelected(true); this.selectedIndex = index; this.revalidate(); } }
/** * Creates preview for the device(video) in the video container. * * @param device the device * @param videoContainer the container * @throws IOException a problem accessing the device. * @throws MediaException a problem getting preview. */ private static void createPreview(MediaDevice device, final JComponent videoContainer) throws IOException, MediaException { videoContainer.removeAll(); videoContainer.revalidate(); videoContainer.repaint(); if (device == null) return; Component c = (Component) GuiActivator.getMediaService() .getVideoPreviewComponent( device, videoContainer.getSize().width, videoContainer.getSize().height); videoContainer.add(c); }
public void setText(@Nullable final String... text) { myText.removeAll(); if (text == null) return; for (int i = 0; i < text.length; i++) { final JLabel eachLabel = new JLabel(text[i], JLabel.CENTER); final int gap = eachLabel.getIconTextGap(); eachLabel.setBorder(new EmptyBorder(0, 0, 0, gap)); eachLabel.setVerticalTextPosition(JLabel.TOP); eachLabel.setFont(eachLabel.getFont().deriveFont(Font.BOLD, eachLabel.getFont().getSize())); myText.add(eachLabel); if (i < text.length - 1) { final JLabel eachIcon = new JLabel(IconLoader.getIcon("/general/comboArrowRight.png"), JLabel.CENTER); eachIcon.setBorder(new EmptyBorder(0, 0, 0, gap)); myText.add(eachIcon); } } }
/** * Creates preview for the (video) device in the video container. * * @param device the device * @param videoContainer the video container * @throws IOException a problem accessing the device * @throws MediaException a problem getting preview */ private static void createVideoPreview(CaptureDeviceInfo device, JComponent videoContainer) throws IOException, MediaException { videoContainer.removeAll(); videoContainer.revalidate(); videoContainer.repaint(); if (device == null) return; for (MediaDevice mediaDevice : mediaService.getDevices(MediaType.VIDEO, MediaUseCase.ANY)) { if (((MediaDeviceImpl) mediaDevice).getCaptureDeviceInfo().equals(device)) { Dimension videoContainerSize = videoContainer.getPreferredSize(); Component preview = (Component) mediaService.getVideoPreviewComponent( mediaDevice, videoContainerSize.width, videoContainerSize.height); if (preview != null) videoContainer.add(preview); break; } } }
@Override protected void zmenaVyberu(final Set<Alela> aAlelyx) { jmenaVybranychAlel = Alela.alelyToNames(aAlelyx); final Genotyp genotyp = new Genotyp(aAlelyx, bag.getGenom()); final Sklivec sklivec = bag.getSklivec(genotyp); jskelneikony.removeAll(); // BoundingRect br = Imagant.sjednoceni(sklivec.imaganti); { jskelneikony.add(Box.createVerticalStrut(20)); final JButton jLabel = new JButton(); jLabel.setAlignmentX(CENTER_ALIGNMENT); // jLabel.setText("všechna skla přes sebe"); final Imagant imagant = Sklo.prekresliNaSebe(sklivec.imaganti); if (imagant != null) { jLabel.setIcon(new ImageIcon(imagant.getImage())); } jskelneikony.add(jLabel); } jskelneikony.add(Box.createVerticalStrut(50)); final Iterator<SkloAplikant> iterator = bag.getSada().getSkloAplikanti().iterator(); for (final Imagant imagant : sklivec.imaganti) { final SkloAplikant skloAplikant = iterator.next(); final Box panel = Box.createHorizontalBox(); final TitledBorder border = BorderFactory.createTitledBorder(skloAplikant.sklo.getName()); border.setTitleJustification(TitledBorder.CENTER); panel.setBorder(border); final JLabel jLabel = new JLabel(); // jLabel.setText("sklo"); if (imagant != null) { jLabel.setIcon(new ImageIcon(imagant.getImage())); } jLabel.setAlignmentX(CENTER_ALIGNMENT); panel.add(Box.createHorizontalGlue()); panel.add(jLabel); panel.add(Box.createHorizontalGlue()); panel.setMinimumSize(new Dimension(150, 100)); panel.setPreferredSize(new Dimension(150, 100)); // JLabel jJmenoSady = new JLabel(skloAplikant.sklo.getName()); // jJmenoSady.setAlignmentX(JComponent.CENTER_ALIGNMENT); // jskelneikony.add(jJmenoSady); jskelneikony.add(panel); jskelneikony.add(Box.createVerticalStrut(10)); } jskelneikony.add(Box.createVerticalGlue()); final JCheckBox jZobrazovaniVseho = new JCheckBox("Zobrazit vše"); jZobrazovaniVseho.setSelected(zobrazovatVse); jskelneikony.add(jZobrazovaniVseho); jZobrazovaniVseho.addItemListener( e -> { zobrazovatVse = jZobrazovaniVseho.isSelected(); resetBag(bag); }); // a teď vyrendrovat vše přes sebe System.out.println(genotyp); jskelneikony.revalidate(); // pack(); }
public static void main(String args[]) { JComponent ch = new JComponent() {}; ch.getAccessibleContext(); ch.isFocusTraversable(); ch.setEnabled(false); ch.setEnabled(true); ch.requestFocus(); ch.requestFocusInWindow(); ch.getPreferredSize(); ch.getMaximumSize(); ch.getMinimumSize(); ch.contains(1, 2); Component c1 = ch.add(new Component() {}); Component c2 = ch.add(new Component() {}); Component c3 = ch.add(new Component() {}); Insets ins = ch.getInsets(); ch.getAlignmentY(); ch.getAlignmentX(); ch.getGraphics(); ch.setVisible(false); ch.setVisible(true); ch.setForeground(Color.red); ch.setBackground(Color.red); for (String font : Toolkit.getDefaultToolkit().getFontList()) { for (int j = 8; j < 17; j++) { Font f1 = new Font(font, Font.PLAIN, j); Font f2 = new Font(font, Font.BOLD, j); Font f3 = new Font(font, Font.ITALIC, j); Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j); ch.setFont(f1); ch.setFont(f2); ch.setFont(f3); ch.setFont(f4); ch.getFontMetrics(f1); ch.getFontMetrics(f2); ch.getFontMetrics(f3); ch.getFontMetrics(f4); } } ch.enable(); ch.disable(); ch.reshape(10, 10, 10, 10); ch.getBounds(new Rectangle(1, 1, 1, 1)); ch.getSize(new Dimension(1, 2)); ch.getLocation(new Point(1, 2)); ch.getX(); ch.getY(); ch.getWidth(); ch.getHeight(); ch.isOpaque(); ch.isValidateRoot(); ch.isOptimizedDrawingEnabled(); ch.isDoubleBuffered(); ch.getComponentCount(); ch.countComponents(); ch.getComponent(1); ch.getComponent(2); Component[] cs = ch.getComponents(); ch.getLayout(); ch.setLayout(new FlowLayout()); ch.doLayout(); ch.layout(); ch.invalidate(); ch.validate(); ch.remove(0); ch.remove(c2); ch.removeAll(); ch.preferredSize(); ch.minimumSize(); ch.getComponentAt(1, 2); ch.locate(1, 2); ch.getComponentAt(new Point(1, 2)); ch.isFocusCycleRoot(new Container()); ch.transferFocusBackward(); ch.setName("goober"); ch.getName(); ch.getParent(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); ch.isValid(); ch.isDisplayable(); ch.isVisible(); ch.isShowing(); ch.isEnabled(); ch.enable(false); ch.enable(true); ch.enableInputMethods(false); ch.enableInputMethods(true); ch.show(); ch.show(false); ch.show(true); ch.hide(); ch.getForeground(); ch.isForegroundSet(); ch.getBackground(); ch.isBackgroundSet(); ch.getFont(); ch.isFontSet(); Container c = new Container(); c.add(ch); ch.getLocale(); for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale); ch.getColorModel(); ch.getLocation(); boolean exceptions = false; try { ch.getLocationOnScreen(); } catch (IllegalComponentStateException e) { exceptions = true; } if (!exceptions) throw new RuntimeException("IllegalComponentStateException did not occur when expected"); ch.location(); ch.setLocation(1, 2); ch.move(1, 2); ch.setLocation(new Point(1, 2)); ch.getSize(); ch.size(); ch.setSize(1, 32); ch.resize(1, 32); ch.setSize(new Dimension(1, 32)); ch.resize(new Dimension(1, 32)); ch.getBounds(); ch.bounds(); ch.setBounds(10, 10, 10, 10); ch.setBounds(new Rectangle(10, 10, 10, 10)); ch.isLightweight(); ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ch.getCursor(); ch.isCursorSet(); ch.inside(1, 2); ch.contains(new Point(1, 2)); ch.isFocusable(); ch.setFocusable(true); ch.setFocusable(false); ch.transferFocus(); ch.getFocusCycleRootAncestor(); ch.nextFocus(); ch.transferFocusUpCycle(); ch.hasFocus(); ch.isFocusOwner(); ch.toString(); ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); ch.setComponentOrientation(ComponentOrientation.UNKNOWN); ch.getComponentOrientation(); }
protected void clear(ArrayList aListComps) { for (int i = 0; i < aListComps.size(); i++) { JComponent comp = (JComponent) aListComps.get(i); comp.removeAll(); } }