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:edu.ucla.stat.SOCR.analyses.gui.ConfidenceIntervalAnalysis.java
protected void doGraph() { graphPanel.removeAll();/*from w ww. j a v a 2s .c om*/ JPanel innerPanel = new JPanel(); JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); graphPanel.add(graphPane); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS)); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); confidenceCanvas = new ConfidenceCanvasGeneralUpper(sampleSizes, nTrials); confidenceCanvas.setBackground(Color.white); innerPanel.setPreferredSize(new Dimension(650, 400)); confidenceCanvas.setIntervalType(ci_choice); innerPanel.add(confidenceCanvas); confidenceCanvas.update(cvIndex, ciData, sampleData, xBar); /* String[][] ci_storage= new String[xyLength][nTrials]; for (int i=0; i<nTrials; i++) for(int j=0; j<sampleSizes[i]; j++) ci_storage[j][i] = sampleData[i][j]+""; JFreeChart bwChart = chartFactory.getBoxAndWhiskerChart("Box and Whisker Plot", independentHeader, "yHeader", nTrials, 1, xyLength, ci_storage); ChartPanel chartPanel = new ChartPanel(bwChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight)); innerPanel.add(chartPanel); */ graphPanel.validate(); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
/** * Cria os componentes// w ww .j a va 2 s . co m * */ private void initComponentsEscalavel() { TradSimuladorNavegacao.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.getTextPane().setEditable(false); // scrollPaneDescricao.getTextPane().setContentType("text/html;"); conteudoDoAlt = new JTextArea(); parentFrame.setTitle(TradSimuladorNavegacao.TITULO_SIMULADOR_CEGO); parentFrame.setJMenuBar(this.criaMenuBar()); tabelaDescricao = new TabelaDescricao(this); tabelaDescricao.addMouseListener(this); conteudoDoAlt = new JTextArea(); abrir = new JButton(); cancelar = new JButton(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); pnBotoes = new JPanel(); buscar = new JButton(); this.setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda("")); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(TradSimuladorNavegacao.SELECIONE_ITEM_TABELA); lbRegras2.setText(TradSimuladorNavegacao.DE_UMA_PAGINA); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); // ======== pnDescricao ======== abrir.setText(Ferramenta_Scripts.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Scripts.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.setBounds(10, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.setBounds(165, 0, 150, 25); // ======== pnParticRotulo ======== pnSetaDescricao.setBorder(criaBorda(TradSimuladorNavegacao.DIGITE_TEXTO_BUSCADO)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); // ======== spParticRotulo ======== { spTextoDescricao.setViewportView(conteudoDoAlt); } pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { pnListaErros.setBorder(criaBorda(TradSimuladorNavegacao.LINKS_INTERNOS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tabelaDescricao); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- // ---- aplicarRotulo ---- buscar.setText(TradSimuladorNavegacao.BUSCAR_PROXIMA); buscar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { BuscarActionPerformed(e); } }); buscar.setToolTipText(TradSimuladorNavegacao.BUSCAR_TEXTO); buscar.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.BUSCAR_TEXTO); buscar.getAccessibleContext().setAccessibleName(TradSimuladorNavegacao.BUSCAR_TEXTO); buscar.setBounds(10, 5, 150, 25); pnBotoes.add(buscar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(textAreaSourceCode, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); 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)); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:jprobix.ui.UI.java
@SuppressWarnings("empty-statement") private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed uList.clear();//from w w w . ja va 2 s. c o m ziarno.clear(); ziarno.add(x1); ziarno.add(x2); ziarno.add(x3); ziarno.add(x4); if (size > 0) { uList.add(a1); uList.add(a2); uList.add(a3); uList.add(a4); } int xN = 0; if (size > 0) { int i = 0; while (i < (size - (ziarno.size()))) { int ij; ij = ((ziarno.get(ziarno.size() - 1) * uList.get(uList.size() - 1) + ziarno.get(ziarno.size() - 2) * uList.get(uList.size() - 2) + ziarno.get(ziarno.size() - 3) * uList.get(uList.size() - 3) + ziarno.get(ziarno.size() - 4) * uList.get(uList.size() - 4)) + c) % m; if (ij >= rozkladI) { uList.add(ij); } else { ij = ij + rozkladI; uList.add(ij); } i++; } } jTextAreaConsole.insert(uList + "\n", 0); JPanel jpanel3 = creteDemoPanel(); jpanel3.setPreferredSize(new Dimension(640, 480)); ds = createDataset(); cp.repaint(); chart = ChartFactory.createScatterPlot("Wykres XY", "U(i)", "U(i+1)", ds, PlotOrientation.VERTICAL, true, true, false); xyPlot = (XYPlot) chart.getPlot(); renderer = xyPlot.getRenderer(); cp.repaint(); cp = new ChartPanel(chart); cp.repaint(); jTabbedPane2.removeAll(); jTabbedPane2.addTab("wygenerowane punkty", cp); cp.setMouseWheelEnabled(true); cdb = createDatasetBar(); chartBar = ChartFactory.createXYBarChart("Histogram", // chart title "Zmienne", // domain axis label false, "Wartosci zmiennych", // range axis label cdb, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); PlotBar = (XYPlot) chartBar.getPlot(); rendererBar = (XYBarRenderer) PlotBar.getRenderer(); chartPanelBar = new ChartPanel(chartBar); jTabbedPane2.addTab("histogram", chartPanelBar); chartPanelBar.setMouseWheelEnabled(true); for (int i = 0; i < uList.size(); i++) { //suma MediumS += uList.get(i); } MediumS = MediumS / uList.size(); //liczymy redni jTextFieldS.setText("" + MediumS); MediumO = 0.0; for (int i = 0; i < uList.size(); i++) { //suma MediumO += pow(uList.get(i), 2); } MediumO = abs(MediumO / (uList.size())); //liczymy redni odchylenieSigma = sqrt((MediumO - (MediumS * MediumS))); jTextFieldO.setText("" + odchylenieSigma); }
From source file:lol.search.RankedStatsPage.java
private JPanel bodyPanel(JPanel body) { body.setLayout(new BoxLayout(body, BoxLayout.X_AXIS)); body.setBackground(backgroundColor); body.setPreferredSize(new Dimension(1200, 530)); //load art //from w w w . j ava 2 s .c om this.loadArtLabel.setAlignmentX(Component.LEFT_ALIGNMENT); this.loadArtLabel.setPreferredSize(new Dimension(290, 504)); this.loadArtLabel.setIcon(OBJ_GAME_STATIC_DATA.initLoadingArt(champKeyList.get(0))); body.add(this.loadArtLabel); JPanel rightPanel = new JPanel(new FlowLayout()); rightPanel.setPreferredSize(new Dimension(800, 514)); rightPanel.setOpaque(false); //rightPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel headerPanel = new JPanel(); headerPanel.setLayout(new BoxLayout(headerPanel, BoxLayout.X_AXIS)); headerPanel.setPreferredSize(new Dimension(910, 55)); headerPanel.setOpaque(false); //headerPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); this.defaultHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 40)); //custom font this.defaultHeader.setForeground(Color.WHITE); this.defaultHeader.setAlignmentX(Component.LEFT_ALIGNMENT); this.defaultHeader.setText(" Season Totals: "); this.nameHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 40)); //custom font this.nameHeader.setForeground(valueOrange); this.nameHeader.setAlignmentX(Component.LEFT_ALIGNMENT); this.nameHeader.setText("Overall"); this.titleHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 16)); //custom font this.titleHeader.setForeground(new Color(255, 128, 0)); this.titleHeader.setAlignmentX(Component.LEFT_ALIGNMENT); //nameHeader.setAlignmentY(Component.TOP_ALIGNMENT); titleHeader.setAlignmentY(Component.TOP_ALIGNMENT); headerPanel.add(defaultHeader); headerPanel.add(nameHeader); headerPanel.add(titleHeader); rightPanel.add(headerPanel); rightPanel.add(statsPanel()); body.add(rightPanel); return body; }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildProjectPanel() { JPanel projectPanel = new JPanel(new BorderLayout()); projectPanel.setBorder(new TitledBorder("Projects")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); projectList.addListSelectionListener(new ProjectListSelectionListener()); sidePanel.add(new JScrollPane(projectList), BorderLayout.CENTER); projectPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(projectName);//from w w w . ja v a 2 s . co m projectName.setEditable(false); infoPanel.add(projectDescription); projectDescription.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); projectPanel.add(sidePanel, BorderLayout.EAST); return projectPanel; }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildConfigurationPanel() { JPanel configPanel = new JPanel(new BorderLayout()); configPanel.setBorder(new TitledBorder("Configurations")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); configurationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); configurationList.addListSelectionListener(new ConfigListSelectionListener()); sidePanel.add(new JScrollPane(configurationList), BorderLayout.CENTER); configPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(configurationName);/*w w w.ja v a2 s.co m*/ configurationName.setEditable(false); infoPanel.add(configurationDesc); configurationDesc.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); configPanel.add(sidePanel, BorderLayout.EAST); return configPanel; }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildTestbedPanel() throws RemoteException { JPanel testbedPanel = new JPanel(new BorderLayout()); testbedPanel.setBorder(new TitledBorder("Physical Deployments")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); testbedList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); testbedList.setListData(testbedManager.getTestbedList().toArray()); testbedList.addListSelectionListener(new TestbedListSelectionListener()); sidePanel.add(new JScrollPane(testbedList), BorderLayout.CENTER); testbedPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(testbedName);//ww w.j av a 2s.com testbedName.setEditable(false); infoPanel.add(testbedDescription); testbedDescription.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); testbedPanel.add(sidePanel, BorderLayout.EAST); return testbedPanel; }
From source file:components.SharedModelDemo.java
public SharedModelDemo() { super(new BorderLayout()); Vector data = new Vector(7); String[] columnNames = { "French", "Spanish", "Italian" }; String[] oneData = { "un", "uno", "uno" }; String[] twoData = { "deux", "dos", "due" }; String[] threeData = { "trois", "tres", "tre" }; String[] fourData = { "quatre", "cuatro", "quattro" }; String[] fiveData = { "cinq", "cinco", "cinque" }; String[] sixData = { "six", "seis", "sei" }; String[] sevenData = { "sept", "siete", "sette" }; //Build the model. SharedDataModel dataModel = new SharedDataModel(columnNames); dataModel.addElement(oneData);// w ww. ja v a2 s .c o m dataModel.addElement(twoData); dataModel.addElement(threeData); dataModel.addElement(fourData); dataModel.addElement(fiveData); dataModel.addElement(sixData); dataModel.addElement(sevenData); list = new JList(dataModel); list.setCellRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList l, Object value, int i, boolean s, boolean f) { String[] array = (String[]) value; return super.getListCellRendererComponent(l, array[0], i, s, f); } }); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); table = new JTable(dataModel); table.setSelectionModel(listSelectionModel); JScrollPane tablePane = new JScrollPane(table); //Build control area (use default FlowLayout). JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); //Build output area. output = new JTextArea(10, 40); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); //Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.X_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); JPanel tableContainer = new JPanel(new GridLayout(1, 1)); tableContainer.setBorder(BorderFactory.createTitledBorder("Table")); tableContainer.add(tablePane); tablePane.setPreferredSize(new Dimension(300, 100)); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(400, 50)); topHalf.setPreferredSize(new Dimension(400, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.NORTH); bottomHalf.add(outputPane, BorderLayout.CENTER); //XXX: next line needed if bottomHalf is a scroll pane: //bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }
From source file:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);// w w w .j a v a 2s . c o m paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:TextInputDemo.java
protected JComponent createAddressDisplay() { JPanel panel = new JPanel(new BorderLayout()); addressDisplay = new JLabel(); addressDisplay.setHorizontalAlignment(JLabel.CENTER); regularFont = addressDisplay.getFont().deriveFont(Font.PLAIN, 16.0f); italicFont = regularFont.deriveFont(Font.ITALIC); updateDisplays();/*w w w.ja v a 2s .co m*/ //Lay out the panel. panel.setBorder(BorderFactory.createEmptyBorder(GAP / 2, //top 0, //left GAP / 2, //bottom 0)); //right panel.add(new JSeparator(JSeparator.VERTICAL), BorderLayout.LINE_START); panel.add(addressDisplay, BorderLayout.CENTER); panel.setPreferredSize(new Dimension(200, 150)); return panel; }