List of usage examples for javax.swing JPanel setSize
public void setSize(Dimension d)
From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java
private final JPanel buildBottomPanel() { JPanel panel = new JPanel(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(); Dimension size = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT / 10); panel.setSize(size); panel.setPreferredSize(size);/*from w ww . ja v a2s . c om*/ tabbedPane.add("Symbol Profiling", new JScrollPane(profilingSymbolTable)); tabbedPane.add("Message Profiling", new JScrollPane(profilingMsgTable)); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { profilingSymbolTable.clearSelection(); profilingMsgTable.clearSelection(); } }); panel.add(tabbedPane); return panel; }
From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java
private final JPanel buildLeftPanel() throws ClassNotFoundException { JPanel panel = new JPanel(new BorderLayout()); Dimension size = new Dimension(WINDOW_WIDTH / 4, (int) (WINDOW_HEIGHT * (2 / 3.0))); panel.setBorder(new TitledBorder("Programs")); panel.setSize(size); panel.setPreferredSize(size);//from w w w. java 2s. c om panel.setMinimumSize(size); panel.add(new JScrollPane(programTree), BorderLayout.CENTER); return panel; }
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:com.xilinx.kintex7.MainScreen.java
private JPanel plotPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); String[] labels0 = { "S2C0 ", "S2C1 ", "PCIe Reads " }; String[] labels1 = { "C2S0 ", "C2S1 ", "PCIe Writes " }; dma0chart = new DMABarChart("Transmit (S2C) Performance", panel1.getBackground(), labels0); dma1chart = new DMABarChart("Receive (C2S) Performance", panel1.getBackground(), labels1); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel1.setSize(new Dimension(panel1.getWidth() - 100, panel1.getHeight() - 100)); panel1.add(dma0chart.getChart("")); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); panel2.setSize(new Dimension(panel2.getWidth() - 100, panel2.getHeight() - 100)); panel2.add(dma1chart.getChart("")); panel.add(panel1);// w w w .j av a 2 s . co m panel.add(panel2); return panel; }
From source file:com.t3.client.ui.T3Frame.java
public void showControlPanel(JPanel... panels) { JPanel layoutPanel = new JPanel(new GridBagLayout()); layoutPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); int i = 0;//from w w w . j a v a 2 s . com for (JPanel panel : panels) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = i; gbc.weightx = 1; gbc.fill = GridBagConstraints.BOTH; layoutPanel.add(panel, gbc); i++; } layoutPanel.setSize(layoutPanel.getPreferredSize()); zoneRendererPanel.add(layoutPanel, PositionalLayout.Position.NE); zoneRendererPanel.setComponentZOrder(layoutPanel, 0); zoneRendererPanel.revalidate(); zoneRendererPanel.repaint(); visibleControlPanel = layoutPanel; }
From source file:com.xilinx.virtex7.MainScreen.java
private JPanel plotPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); String[] labels0 = { "S2C0 ", "S2C1 ", "S2C2 ", "S2C3 ", "PCIe Reads " }; String[] labels1 = { "C2S0 ", "C2S1 ", "C2S2 ", "C2S3 ", "PCIe Writes " }; dma0chart = new DMABarChart("Transmit (S2C) Performance", panel1.getBackground(), labels0); dma1chart = new DMABarChart("Receive (C2S) Performance", panel1.getBackground(), labels1); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel1.setSize(new Dimension(panel1.getWidth() - 100, panel1.getHeight() - 100)); panel1.add(dma0chart.getChart("")); panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS)); panel2.setSize(new Dimension(panel2.getWidth() - 100, panel2.getHeight() - 100)); panel2.add(dma1chart.getChart("")); panel.add(panel1);//www. jav a 2 s .com panel.add(panel2); return panel; }
From source file:com.xilinx.ultrascale.gui.MainScreen.java
public JPanel createPanelForGraph(JPanel panel) { // dimensions Dimension dmsns = new Dimension(panel.getWidth(), panel.getHeight()); JPanel dmaStatsPanel = new JPanel(); dmaStatsPanel.setLayout(new BoxLayout(dmaStatsPanel, BoxLayout.Y_AXIS)); dmaStatsPanel.setSize(dmsns); return dmaStatsPanel; }
From source file:edu.ku.brc.specify.utilapps.sp5utils.Sp5Forms.java
/** * @param fi//from w w w. j a v a2 s . co m * @return */ protected FormPanelInfo createPanel(final FormInfo formInfo) { CellConstraints cc = new CellConstraints(); JPanel panel = new JPanel(null); int maxWidth = 0; int maxHeight = 0; int maxCellWidth = 0; int maxCellHeight = 0; for (FormFieldInfo fi : formInfo.getFields()) { System.out.println(fi.getCaption()); boolean addLbl = true; JComponent comp = null; switch (fi.getControlTypeNum()) { case 4: comp = createComboBox(); // 'Picklist' break; case 5: { JComboBox cbx = createComboBox(); //new ValComboBoxFromQuery(DBTableIdMgr.getInstance().getInfoById(1), "catalogNumber","CatalogNumber","CatalogNumber"," "," "," "," "," ",ValComboBoxFromQuery.CREATE_ALL);// 'QueryCombo' cbx.setEditable(true); cbx.getEditor().setItem(fi.getCaption()); JPanel cPanel = new JPanel(new BorderLayout()); cPanel.add(cbx, BorderLayout.CENTER); cPanel.add(createElipseBtn(), BorderLayout.EAST); comp = cPanel; addLbl = false; break; } case 7: { String uniqueKey = getUniqueKey(fi.getRelatedTableName(), "Embedded", fi.getParent().getFormType()); FormInfo subForm = formHash.get(uniqueKey); if (subForm == null) { uniqueKey = getUniqueKey(fi.getRelatedTableName(), "Embedded", null); subForm = formHash.get(uniqueKey); } if (subForm != null) { Vector<String> headers = new Vector<String>(); for (int i = 0; i < subForm.getFields().size(); i++) { headers.add(subForm.getFields().get(i).getCaption()); } JPanel p = new JPanel(new BorderLayout()); p.add(UIHelper.createScrollPane(new JTable(new Vector<Vector<Object>>(), headers)), BorderLayout.CENTER); // 'Grid' comp = p; addLbl = false; } break; } case 8: // 'EmbeddedForm' { String uniqueKey = getUniqueKey(fi.getRelatedTableName(), "Embedded", fi.getParent().getFormType()); FormInfo subForm = formHash.get(uniqueKey); if (subForm == null) { uniqueKey = getUniqueKey(fi.getRelatedTableName(), "Embedded", null); subForm = formHash.get(uniqueKey); } comp = (subForm != null ? createPanel(subForm).getPanel() : new JPanel()); addLbl = fi.getControlTypeNum() != 8; break; } case 9: { comp = createElipseBtn(); break; } case 20: comp = createScrollPane(createTextArea()); // 'Memo' break; case 21: comp = null;//createComboBox(); // 'MenuItem' break; case 46: comp = createTextField("URL"); // 'URL' break; default: if (fi.getDataTypeNum() == 4) { comp = createCheckBox(" "); } else { comp = createTextField(); } } // switch if (comp != null) { String toolTip = "Field: " + fi.getSp5FieldName() + (StringUtils.isNotEmpty(fi.getSp6FieldName()) && fi.getSp6FieldName().equalsIgnoreCase(fi.getSp5FieldName()) ? " Sp6: " + fi.getSp6FieldName() : ""); comp.setToolTipText(toolTip); PanelBuilder pb = new PanelBuilder(new FormLayout("p,1px,f:p:g", "f:p:g,p,f:p:g")); pb.getPanel().setToolTipText(toolTip); pb.getPanel().setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); if (addLbl) { pb.add(createLabel(fi.getCaption()), cc.xy(1, 2)); } pb.add(comp, cc.xy(3, 2)); panel.add(pb.getPanel()); maxWidth = Math.max(maxWidth, fi.getLeft() + fi.getWidth()); maxHeight = Math.max(maxHeight, fi.getTop() + fi.getHeight()); maxCellWidth = Math.max(maxWidth, fi.getCellX() + fi.getCellWidth()); maxCellHeight = Math.max(maxHeight, fi.getCellY() + fi.getCellHeight()); boolean newWay = false; if (newWay) { Rectangle r = fi.getBoundsFromCellDim(); pb.getPanel().setLocation(r.x, r.y); pb.getPanel().setSize(r.width, r.height); } else { pb.getPanel().setLocation(fi.getLeft(), fi.getTop()); pb.getPanel().setSize(fi.getWidth(), fi.getHeight()); } System.out.println("MaxW: " + maxWidth + " " + maxCellWidth); System.out.println("MaxH: " + maxHeight + " " + maxCellHeight); } } boolean newWay = false; if (newWay) { int cw = FormFieldInfo.getSegWidth(); panel.setPreferredSize(new Dimension(maxCellWidth * cw, maxCellHeight * cw)); panel.setSize(new Dimension(maxCellWidth * cw, maxCellHeight * cw)); } else { panel.setPreferredSize(new Dimension(maxWidth, maxHeight)); panel.setSize(new Dimension(maxWidth, maxHeight)); } System.out.println("MaxW: " + maxWidth + " " + maxCellWidth); System.out.println("MaxH: " + maxHeight + " " + maxCellHeight); return new FormPanelInfo(formInfo.getTitle(), panel, maxWidth, maxHeight); }
From source file:org.isatools.isacreator.gui.DataEntryForm.java
protected JPanel createTextEditEnabledField(JTextComponent component) { JPanel container = new JPanel(); container.setLayout(new BorderLayout()); container.add(component, BorderLayout.CENTER); TextEditUtility textEdit = new TextEditUtility(component); textEdit.setVerticalAlignment(SwingConstants.TOP); JPanel textEditPanel = new JPanel(); UIHelper.setLayoutForEditingIcons(textEditPanel, textEdit); textEditPanel.setSize(new Dimension(23, 23)); container.add(textEditPanel, BorderLayout.EAST); return container; }
From source file:org.jas.dnd.DragTooltipDialog.java
private DynamicPanel getDynamicPanel(IconType type, List<?> list) { if (list == null || list.isEmpty()) { return null; }//from ww w. ja v a2 s . co m JPanel dynamicPanel = null; JLabel dynamicText = null; String text = list.isEmpty() ? null : (list.size()) + " " + (type == null ? "ERROR" : type.getText()); if (list.size() == 1) { text = list.get(0) instanceof File ? ((File) list.get(0)).getName() : list.get(0).toString(); } dynamicText = new JLabel(text); dynamicText.setForeground(Color.WHITE); FontMetrics fontMetrics = dynamicText.getFontMetrics(dynamicText.getFont()); int width = fontMetrics.stringWidth(dynamicText.getText()) + DEFAULT_MIN_FONT_WIDTH; int realHeight = ROW_HEIGHT; String longestText = ""; while (text.contains("<br>")) { text = text.substring(text.indexOf("<br>") + DEFAULT_MIN_FONT_WIDTH); if (text.length() > longestText.length()) { longestText = text; } realHeight += ROW_HEIGHT; } if (!longestText.isEmpty()) { width = fontMetrics.stringWidth(longestText) + DEFAULT_MIN_FONT_WIDTH; } dynamicPanel = new JPanel(); dynamicPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); dynamicPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, realHeight)); dynamicPanel.setMinimumSize(new Dimension(0, realHeight)); dynamicPanel.setPreferredSize(new Dimension(100, realHeight)); dynamicPanel.setSize(new Dimension(100, realHeight)); if (type != null) { dynamicPanel.add(getDynamicIcon(type), null); JPanel spacer = new JPanel(); Dimension d = new Dimension(SPACER_WIDTH, SPACER_WIDTH); width += SPACER_WIDTH; spacer.setSize(d); spacer.setMinimumSize(d); spacer.setMaximumSize(d); spacer.setPreferredSize(d); dynamicPanel.add(spacer); width += type.width; } dynamicPanel.add(dynamicText); return new DynamicPanel(dynamicPanel, width, realHeight); }