List of usage examples for javax.swing JPanel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:game.Clue.ClueGameUI.java
private void CreateBoard() { //resize and center frame to fit all components of game(board,scorecard,buttons,etc) this.setSize(1030, 670); Dimension dimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); int x = (int) ((dimension.getWidth() - this.getWidth()) / 2); int y = (int) ((dimension.getHeight() - this.getHeight()) / 2); this.setLocation(x, y); NonCornerRoom NonCornerRoom_current; // Board gameBoard = new Board(); ArrayList<String> RoomsAndHallways = new ArrayList<>(Arrays.asList("STUDY", "HALLWAY1", "HALL", "HALLWAY2", "LOUNGE", "HALLWAY3", "BLANK", "HALLWAY4", "BLANK", "HALLWAY5", "LIBRARY", "HALLWAY6", "BILLIARD ROOM", "HALLWAY7", "DINING ROOM", "HALLWAY8", "BLANK", "HALLWAY9", "BLANK", "HALLWAY10", "CONSERVATORY", "HALLWAY11", "BALL ROOM", "HALLWAY12", "KITCHEN")); ArrayList<String> RoomNames = new ArrayList<>( Arrays.asList("Hall", "Library", "BillardRoom", "BallRoom", "DiningRoom")); //RoomNames=["Hall","Library","BillardRoom","BallRoom","DiningRoom"]; ArrayList<NonCornerRoom> NonCornerRooms = new ArrayList<>(Arrays.asList(new NonCornerRoom(""), new NonCornerRoom(""), new NonCornerRoom(""), new NonCornerRoom(""))); for (int i = 0; i < 4; i++) { NonCornerRoom_current = NonCornerRooms.get(i); NonCornerRoom_current.setRoomName(RoomNames.get(i)); System.out.println("jlayer=" + NonCornerRoom_current.getRoomName()); }// w w w . j a va2 s . co m gameBoard = new JPanel(); JPanel gameBoard_background = new JPanel(); gameBoard_background.setLayout(new BorderLayout(1, 1)); gameBoard_background.setPreferredSize(new Dimension(701, 590)); gameBoard_background.setBounds(0, 0, 701, 590); jLayeredPane5.add(gameBoard, new Integer(1)); gameBoard.setLayout(new GridLayout(5, 5)); gameBoard.setOpaque(false); gameBoard.setPreferredSize(new Dimension(701, 590)); gameBoard.setBounds(0, 0, 701, 590); Border roomBoarder = BorderFactory.createLineBorder(Color.white, 2); //draw rooms onto board for (int i = 0; i < 25; i++) { JPanel room_square = new JPanel(new BorderLayout()); System.out.println(i); room_square.setName(RoomsAndHallways.get(i)); System.out.println(RoomsAndHallways.get(i)); gameBoard.add(room_square); int row = (i / 12) % 2; if (row == 0) { //room_square.setBackground(i % 2 == 0 ? Color.white : Color.gray); //room_square.setBorder(roomBoarder); room_square.setOpaque(false); //room_square. //room_square.add(new JLabel("Room# "+i)); } else { //room_square.setBackground(i % 2 == 0 ? Color.gray : Color.white); //room_square.setBorder(roomBoarder); room_square.setOpaque(false); //room_square.add(new JLabel("Room# "+i)); } } //add Players to board (use "for" statement later to reduce lines of code) ImageIcon player_icon = new ImageIcon(getClass().getResource("/resources/scarletphoto.png"), "MissScarlett"); JPanel panel = (JPanel) gameBoard.getComponent(3); //MS SCARLET starting position player.setIcon(player_icon); player.setHorizontalAlignment(SwingConstants.CENTER); panel.add(player, SwingConstants.CENTER); ImageIcon player2_icon = new ImageIcon(getClass().getResource("/resources/mustardphoto.png"), "Mustard"); JPanel panel2 = (JPanel) gameBoard.getComponent(9); //ColMustard starting position player2.setIcon(player2_icon); player2.setHorizontalAlignment(SwingConstants.CENTER); panel2.add(player2, SwingConstants.CENTER); //panel.add(player, SwingConstants.CENTER); ImageIcon player3_icon = new ImageIcon(getClass().getResource("/resources/plumphoto.png"), "ProfessorPlum"); JPanel panel3 = (JPanel) gameBoard.getComponent(5); //Plum starting position player3.setIcon(player3_icon); player3.setHorizontalAlignment(SwingConstants.CENTER); panel3.add(player3, SwingConstants.CENTER); ImageIcon player4_icon = new ImageIcon(getClass().getResource("/resources/peacockphoto.png"), "MsPeacock"); JPanel panel4 = (JPanel) gameBoard.getComponent(15); //Peacock starting position player4.setIcon(player4_icon); player4.setHorizontalAlignment(SwingConstants.CENTER); panel4.add(player4, SwingConstants.CENTER); ImageIcon player5_icon = new ImageIcon(getClass().getResource("/resources/greenphoto.png"), "Mr.Green"); JPanel panel5 = (JPanel) gameBoard.getComponent(21); //MrGreen starting position player5.setIcon(player5_icon); player5.setHorizontalAlignment(SwingConstants.CENTER); panel5.add(player5, SwingConstants.CENTER); ImageIcon player6_icon = new ImageIcon(getClass().getResource("/resources/whitephoto.png"), "Ms.White"); JPanel panel6 = (JPanel) gameBoard.getComponent(23); //MsWhite starting position player6.setIcon(player6_icon); player6.setHorizontalAlignment(SwingConstants.CENTER); panel6.add(player6, SwingConstants.CENTER); ImageIcon room_icon = new ImageIcon(getClass().getResource("/resources/newgamebackground-6.png")); JLabel room_icon_label = new JLabel(); room_icon_label.setIcon(room_icon); gameBoard_background.add(room_icon_label); jLayeredPane5.add(gameBoard_background, new Integer(0)); gameBoard_background.setVisible(true); room_icon_label.setVisible(true); //jLayeredPane5.add(room_icon_label,JLayeredPane.DRAG_LAYER); //jLayeredPane5.moveToFront(room_icon_label); //jPanel5.add(jLayeredPane1); //jPanel5.repaint(); //jPanel5.setVisible(true); //System.out.println("JToggleButton2 Action Performed"); packageGameState(); //jPanel3.add(gameBoard, "card4"); }
From source file:be.ac.ua.comp.scarletnebula.gui.InteractiveFirewallPanel.java
public InteractiveFirewallPanel(final CloudProvider provider) { super(new BorderLayout()); this.provider = provider; ruleList = new RuleList(provider); final JPanel mainPanel = new JPanel(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 0.25;//from w ww . j a v a 2 s . c om c.weighty = 1.0; c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 10, 10, 5); final JPanel firewallPanel = new JPanel(new BorderLayout()); firewallPanel.add(firewallList, BorderLayout.CENTER); final JPanel firewallButtonPanel = new JPanel(); firewallButtonPanel.setLayout(new BoxLayout(firewallButtonPanel, BoxLayout.PAGE_AXIS)); firewallButtonPanel.setOpaque(true); firewallButtonPanel.setBackground(Color.white); addFirewallButton.setMaximumSize(new Dimension(500, 500)); addFirewallButton.addActionListener(new AddFirewallActionListener(provider)); firewallButtonPanel.add(addFirewallButton); deleteFirewallButton.setMaximumSize(new Dimension(500, 500)); deleteFirewallButton.addActionListener(new DeleteFirewallActionListener(provider)); firewallButtonPanel.add(deleteFirewallButton); firewallPanel.add(firewallButtonPanel, BorderLayout.PAGE_END); final JScrollPane firewallListScroller = new JScrollPane(firewallPanel); firewallPanel.setPreferredSize(new Dimension(10, 10)); mainPanel.add(firewallListScroller, c); c.weightx = 0.75; c.gridx = 1; c.insets = new Insets(10, 5, 10, 10); ruleList.setFillsViewportHeight(true); ruleList.setEnabled(false); firewallList.getSelectionModel().addListSelectionListener( new FirewallListSelectionListener(ruleList, addRulebutton, deleteRuleButton, deleteFirewallButton)); final JScrollPane ruleListScroller = new JScrollPane(ruleList); final JPanel ruleListPanel = new JPanel(new BorderLayout()); ruleListPanel.add(ruleListScroller, BorderLayout.CENTER); final JPanel ruleListButtonPanel = new JPanel(); addRulebutton.addActionListener(new AddRuleActionListener(provider)); deleteRuleButton.addActionListener(new DeleteRuleActionListener()); ruleListButtonPanel.add(addRulebutton); ruleListButtonPanel.add(deleteRuleButton); addRulebutton.setEnabled(false); deleteRuleButton.setEnabled(false); deleteFirewallButton.setEnabled(false); ruleListPanel.add(ruleListButtonPanel, BorderLayout.SOUTH); ruleListPanel.setPreferredSize(new Dimension(10, 10)); mainPanel.add(ruleListPanel, c); add(mainPanel, BorderLayout.CENTER); final JPanel allThrobbersPanel = getThrobbersPanel(); add(allThrobbersPanel, BorderLayout.NORTH); loadInitialFirewalls(); }
From source file:org.esa.snap.rcp.spectrum.SpectrumTopComponent.java
private void initUI() { final JFreeChart chart = ChartFactory.createXYLineChart(Bundle.CTL_SpectrumTopComponent_Name(), "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); }/*from w w w. j a va2s.co m*/ }); chart.getXYPlot().getDomainAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { //do nothing } @Override public void pointDeselected() { //do nothing } }); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(e -> { selectSpectralBands(); recreateChart(); }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(e -> recreateChart()); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(e -> { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(e -> { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(e -> chartHandler.setGridVisible(showGridButton.isSelected())); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(new HelpAction(this), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); SnapApp.getDefault().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (currentView != null) { final RasterDataNode currentRaster = currentView.getRaster(); if (rasterToSpectraMap.containsKey(currentRaster)) { rasterToSpectraMap.remove(currentRaster); } if (rasterToSpectralBandsMap.containsKey(currentRaster)) { rasterToSpectralBandsMap.remove(currentRaster); } } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = getSelectedProductSceneView(); if (view != null) { productSceneViewSelected(view); } setDisplayName(Bundle.CTL_SpectrumTopComponent_Name()); setLayout(new BorderLayout()); add(mainPane, BorderLayout.CENTER); updateUIState(); }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * @param containerPanel/* w w w . j a va2 s. c om*/ */ private void createPlotPreviewPanel(JPanel containerPanel) { JPanel previewPanel = new JPanel(new GridBagLayout()); previewPanel.setPreferredSize(new Dimension(300, 300)); GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; // nominal value color preview { nominalPreviewPanel = nominalPlotter.getChartPanel(); nominalPreviewPanel.setPreferredSize(new Dimension(150, 150)); previewPanel.add(nominalPreviewPanel, itemConstraint); } // add gradient preview { gradientPreviewPanel = gradientPlotter.getChartPanel(); gradientPreviewPanel.setPreferredSize(new Dimension(150, 150)); previewPanel.add(gradientPreviewPanel, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; containerPanel.add(previewPanel, itemConstraint); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
/** * Inicia os componentes/*from w w w . ja v a 2s . c o m*/ * * @param erros */ private void initComponentsEscalavel(ArrayList<FerramentaAnaliseGeralModel> erros) { incValueProgress(); hashCodeInicial = null; PainelStatusBar.hideProgTarReq(); Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); PainelStatusBar.setValueProgress(3); boxCode = new G_TextAreaSourceCode(); boxCode.setTipoHTML(); incValueProgress(); parentFrame.setJMenuBar(this.criaMenuBar()); PainelStatusBar.setValueProgress(6); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaAnaliseGeral(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); incValueProgress(); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); cancelar = new JButton(); salvarMod = new JButton(); salvarPag = new JButton(); aplicarPag = new JButton(); aplicarTod = new JButton(); strConteudoalt = new String(); incValueProgress(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); PainelStatusBar.setValueProgress(10); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(this); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); incValueProgress(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); // salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), salvar, // btnSalvar, parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); boxCode.getTextPane().setText(TxtBuffer.getContent()); PainelStatusBar.setValueProgress(20); String fullUrl = this.enderecoImagem; System.out.println("\t\t\t\t\tendereo da imagem: " + fullUrl); SetImage setImage = new SetImage(this, fullUrl); setImage.start(); incValueProgress(); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); incValueProgress(); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Imagens.REGRAP1); lbRegras2.setText(Ferramenta_Imagens.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); incValueProgress(); } PainelStatusBar.setValueProgress(30); // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); JScrollPane sp = new JScrollPane(); sp.setViewportView(imagemSemDesc); sp.setPreferredSize(new Dimension(500, 300)); // ======== pnDescricao ======== incValueProgress(); // ---- Salvar ---- salvarMod.setText(GERAL.SALVAR_MODIFICADAS); salvarMod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarModificadosActionPerformed(e); } }); incValueProgress(); salvarMod.setToolTipText(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleName(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.setBounds(10, 0, 150, 25); PainelStatusBar.setValueProgress(40); salvarPag.setText(GERAL.SALVAR_ULTIMA); salvarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarPaginaActionPerformed(e); } }); incValueProgress(); salvarPag.setToolTipText(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); salvarPag.setBounds(165, 0, 150, 25); incValueProgress(); salvarMod.setEnabled(false); salvarPag.setEnabled(false); ArrayList<JButton> btnsSalvar = new ArrayList<JButton>(); btnsSalvar.add(salvarMod); btnsSalvar.add(salvarPag); btnsSalvar.add(salvar); salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), btnsSalvar, btnSalvar, parentFrame); aplicarPag.setText(GERAL.APLICAR_PAGINA); aplicarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarPaginaActionPerformed(e); } }); incValueProgress(); PainelStatusBar.setValueProgress(50); aplicarPag.setToolTipText(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_PAGINA); aplicarPag.setBounds(320, 0, 150, 25); incValueProgress(); aplicarTod.setText(GERAL.APLICA_TODOS); aplicarTod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread t = new Thread(new Runnable() { public void run() { aplicarATodosActionPerformed(); } }); t.start(); } }); incValueProgress(); aplicarTod.setToolTipText(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.setBounds(475, 0, 150, 25); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); PainelStatusBar.setValueProgress(60); incValueProgress(); cancelar.setText(GERAL.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.setBounds(630, 0, 150, 25); incValueProgress(); pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; PainelStatusBar.setValueProgress(70); incValueProgress(); pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); // ======== spParticRotulo ======== conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0 || tableLinCod.getNumLinhas() < 1) { System.out.println("conteudo vazio"); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicarPag.setEnabled(true); aplicarTod.setEnabled(true); } else { aplicarTod.setEnabled(true); } } }); { spTextoDescricao.setViewportView(conteudoDoAlt); } incValueProgress(); // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { PainelStatusBar.setValueProgress(80); pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== incValueProgress(); { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); PainelStatusBar.setValueProgress(90); adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.setBounds(10, 5, 150, 25); // pnBotoes.add(adicionar); incValueProgress(); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); incValueProgress(); aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR); aplicar.setBounds(10, 5, 150, 25); // pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); boxCode.setBorder(criaBorda("")); boxCode.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); PainelStatusBar.setValueProgress(93); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, boxCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); incValueProgress(); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); PainelStatusBar.setValueProgress(96); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, cons); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); incValueProgress(); pnSalvarCancelar.add(salvarMod); pnSalvarCancelar.add(salvarPag); pnSalvarCancelar.add(aplicarPag); pnSalvarCancelar.add(aplicarTod); pnSalvarCancelar.add(cancelar); pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); PainelStatusBar.setValueProgress(100); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); contentPane.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); contentPane.add(textoErrosBtn); System.out.println("\t\t\t" + TxtBuffer.getContent()); incValueProgress(); this.setVisible(true); }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
protected void showLicense(String licenseFile) throws IOException { final JTextArea textarea = new JTextArea( IOUtils.toString(FileSync.class.getResourceAsStream("/licenses/" + licenseFile))); JPanel p = new JPanel(new BorderLayout()); JScrollPane scrollpane = new JScrollPane(textarea); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); p.add(scrollpane, BorderLayout.CENTER); p.setMaximumSize(new Dimension(screenSize.width / 2, screenSize.height / 2)); p.setPreferredSize(new Dimension(screenSize.width / 2, screenSize.height / 2)); p.setSize(new Dimension(screenSize.width / 2, screenSize.height / 2)); JOptionPane.showMessageDialog(mainFrame, p, "Lizenz", JOptionPane.INFORMATION_MESSAGE); }
From source file:org.biojava.bio.view.MotifAnalyzer.java
private JPanel getStatisticsTab(int excelNum) throws IOException { JPanel panel = new JPanel(); GroupLayout panelLayout = new GroupLayout((JComponent) panel); panel.setLayout(panelLayout);//w w w . j a v a 2 s.co m panel.setPreferredSize(new java.awt.Dimension(676, 557)); Object[][] tableData = FileConverterTools.readExcel(FileNames.getStatisticsExcelFileName(excelNum)); Object columnName[] = new Object[tableData[0].length]; for (int i = 0; i < columnName.length; i++) columnName[i] = i; tableData = null; //free memory final JTable table = new JTable(); JScrollPane jScrollPane = new JScrollPane(table); table.setFont(new Font(Font.DIALOG, Font.BOLD, 15)); table.setEnabled(false); File file = new File(FileNames.getStatisticsExcelFileName(excelNum)); JTableReadTableModelTask task = new JTableReadTableModelTask(file, null, null, table); task.execute(); JButton button = new JButton("Save to Excel"); panelLayout.setVerticalGroup(panelLayout.createSequentialGroup() .addComponent(jScrollPane, GroupLayout.PREFERRED_SIZE, 485, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40)); panelLayout.setHorizontalGroup(panelLayout.createParallelGroup() .addComponent(jScrollPane, GroupLayout.Alignment.LEADING, 0, 676, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.LEADING, panelLayout.createSequentialGroup().addGap(0, 493, Short.MAX_VALUE) .addComponent(button, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40))); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(MotifAnalyzer.this.mainFrame); if (returnVal == JFileChooser.APPROVE_OPTION) { try { //File file = new File(fc.getSelectedFile().getCanonicalPath()); //JTableWriteTableModelTask task = new JTableWriteTableModelTask(file, null, null, table); //task.execute(); } catch (Exception e) { e.printStackTrace(); } } } }); return panel; }
From source file:org.esa.beam.visat.toolviews.spectrum.SpectrumToolView.java
@Override public JComponent createControl() { final JFreeChart chart = ChartFactory.createXYLineChart(CHART_TITLE, "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(new AxisChangeListener() { @Override//from w ww.jav a 2 s.c o m public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getDomainAxis().addChangeListener(new AxisChangeListener() { @Override public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { if (hasDiagram()) { if (cursorSynchronizer == null) { cursorSynchronizer = new CursorSynchronizer(VisatApp.getApp()); } if (!cursorSynchronizer.isEnabled()) { cursorSynchronizer.setEnabled(true); } } } @Override public void pointDeselected() { cursorSynchronizer.setEnabled(false); } }); titleBase = getDescriptor().getTitle(); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectSpectralBands(); recreateChart(); } }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { recreateChart(); } }); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showAveragePinSpectrumButton = ToolButtonFactory.createButton( // UIUtils.loadImageIcon("icons/AverageSpectrum24.gif"), true); // showAveragePinSpectrumButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // } // }); // showAveragePinSpectrumButton.setName("showAveragePinSpectrumButton"); // showAveragePinSpectrumButton.setToolTipText("Show average spectrum of all pin spectra."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartHandler.setGridVisible(showGridButton.isSelected()); } }); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showGraphPointsButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/GraphPoints24.gif"), true); // showGraphPointsButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // JOptionPane.showMessageDialog(null, "Not implemented"); // } // }); // showGraphPointsButton.setName("showGraphPointsButton"); // showGraphPointsButton.setToolTipText("Show graph points grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); /*I18N*/ final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showAveragePinSpectrumButton, gbc); // gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showGraphPointsButton, gbc); // gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId()); } // Add an internal frame listener to VISAT so that we can update our // spectrum dialog with the information of the currently activated // product scene view. // VisatApp.getApp().addInternalFrameListener(new SpectrumIFL()); VisatApp.getApp().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (productToAllSpectraMap.containsKey(product)) { productToAllSpectraMap.remove(product); } if (productToBandsMap.containsKey(product)) { productToBandsMap.remove(product); } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView(); if (view != null) { handleViewActivated(view); } else { setCurrentView(view); } updateUIState(); return mainPane; }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * @return/* ww w . ja v a 2s . c o m*/ */ private JPanel createGradientConfigurationPanel() { // create gradient config panel JPanel gradientConfigPanel = new JPanel(new GridBagLayout()); gradientConfigPanel.setPreferredSize(new Dimension(100, 50)); GridBagConstraints itemConstraint; // add gradient label { JLabel gradientLabel = new ResourceLabel( "plotter.configuration_dialog.color_scheme_dialog.gradient_preview"); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.insets = new Insets(2, 2, 2, 2); gradientConfigPanel.add(gradientLabel, itemConstraint); } // add combobox panel { JPanel comboBoxPanel = new JPanel(new GridBagLayout()); // gradient start panel { JPanel startGradientPanel = createStartGradientPanel(); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 1.0; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.anchor = GridBagConstraints.WEST; itemConstraint.fill = GridBagConstraints.HORIZONTAL; comboBoxPanel.add(startGradientPanel, itemConstraint); } // gradient end panel { JPanel endGradientPanel = createEndGradientPanel(); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 1.0; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.anchor = GridBagConstraints.EAST; itemConstraint.fill = GridBagConstraints.HORIZONTAL; comboBoxPanel.add(endGradientPanel, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 1; itemConstraint.weighty = 0.0; itemConstraint.fill = GridBagConstraints.HORIZONTAL; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.insets = new Insets(2, 2, 2, 2); gradientConfigPanel.add(comboBoxPanel, itemConstraint); } // add 0.0 label { JLabel zeroLabel = new JLabel("0"); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 0; itemConstraint.weighty = 0; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.insets = new Insets(2, 2, 2, 2); gradientConfigPanel.add(zeroLabel, itemConstraint); } // add gradient preview { preview = new GradientPreview(null); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.insets = new Insets(2, 2, 2, 2); gradientConfigPanel.add(preview, itemConstraint); } // add 1.0 label { JLabel zeroLabel = new JLabel("1"); itemConstraint = new GridBagConstraints(); itemConstraint.weightx = 0; itemConstraint.weighty = 0; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.insets = new Insets(2, 2, 2, 2); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; gradientConfigPanel.add(zeroLabel, itemConstraint); } return gradientConfigPanel; }
From source file:beproject.MainGUI.java
void createTagCloud() throws SQLException { TreeMap tmp = getFrequentWords(); Cloud cld = new Cloud(); JPanel tmpPanel = new JPanel(); FlowLayout t1 = new FlowLayout(); tmpPanel.setPreferredSize(new Dimension(512, 512)); tmpPanel.setLayout(t1);// www . ja va 2s . c o m tmpPanel.setBounds(0, 0, 512, 512); //FlowLayout lm=(FlowLayout) tmpPanel.getLayout(); for (int i = 0; i < 40 && !tmp.isEmpty(); i++) { Map.Entry mp = tmp.pollFirstEntry(); Tag t = new Tag((String) mp.getKey(), (int) (mp.getValue())); cld.addTag(t); } Random rand = new Random(); for (Tag tag : cld.tags()) { final JLabel label = new JLabel(tag.getName()); label.setOpaque(false); label.setFont(label.getFont().deriveFont(rand.nextFloat() * 39)); label.setForeground(new Color(rand.nextInt())); tmpPanel.add(label); } if (tagCloudPanel == null) { tagCloudPanel = new JScrollPane(tmpPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } else { jPanel3.remove(tagCloudPanel); jPanel3.validate(); tagCloudPanel = new JScrollPane(tmpPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); } //tagCloudPanel.setLayout(new ScrollPaneLayout()); //tagCloudPanel.setAutoscrolls(true); tmpPanel.validate(); tagCloudPanel.validate(); jPanel3.add(tagCloudPanel, BorderLayout.CENTER); jPanel3.validate(); }