private void setup() { setLayout(new BorderLayout()); JPanel bot = new JPanel(); add(jt.getTableHeader(), BorderLayout.NORTH); bot.setLayout(new BorderLayout()); bot.add(del, BorderLayout.EAST); add(bot, BorderLayout.SOUTH); JScrollPane jsp = new JScrollPane(jt); jsp.setPreferredSize(new Dimension(500, 250)); add(jsp, BorderLayout.CENTER); del.addActionListener(new DListener()); JRootPane rootPane = SwingUtilities.getRootPane(del); rootPane.setDefaultButton(del); setVisible(true); }
private String showInputDialog(String title, String defaultText){ JTextArea msg = new JTextArea(defaultText); msg.setLineWrap(true); msg.setWrapStyleWord(true); JScrollPane scrollPane = new JScrollPane(msg); scrollPane.setPreferredSize(new Dimension(600, 250)); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); int ris = JOptionPane.showConfirmDialog(null, scrollPane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if(ris == JOptionPane.OK_OPTION) return msg.getText(); else return defaultText; }
JTextArea textArea = new JTextArea("Insert your Text here"); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scrollPane.setPreferredSize( new Dimension( 500, 500 ) ); JOptionPane.showMessageDialog(null, scrollPane, "dialog test with textarea", JOptionPane.YES_NO_OPTION);
settings = IgnoreSettings.getInstance(); panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10)); northPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); ); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); northPanel.add(label); final JScrollPane scrollPanel = ScrollPaneFactory.createScrollPane(outerEditor.getComponent()); scrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scrollPanel.setPreferredSize(new Dimension(0, settings.getOuterIgnoreWrapperHeight())); tabbedPanel.addChangeListener(this); panel.add(northPanel, BorderLayout.NORTH); panel.add(tabbedPanel.getComponent(), BorderLayout.CENTER); panel.add(linkLabel, BorderLayout.SOUTH);
@PostConstruct public void init() { setLayout(new BorderLayout()); refreshDevicesButton.setPreferredSize(new Dimension(2500, 32)); refreshDevicesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { presenter.onRefreshDevices(); } }); browserToolBar.setFloatable(false); browserToolBar.add(refreshDevicesButton); // Disables auto-resizing, will fit Container view deviceListPane.setPreferredSize(new Dimension(100, 100)); add(browserToolBar, BorderLayout.SOUTH); add(deviceListPane, BorderLayout.CENTER); }
JPanel test = new JPanel(); test.setPreferredSize(new Dimension( 2000,2000)); JScrollPane scrollFrame = new JScrollPane(test); test.setAutoscrolls(true); scrollFrame.setPreferredSize(new Dimension( 800,300)); this.add(scrollFrame);
private JPanel makeResultsPanel() { JPanel resultsPanel = new JPanel(); resultsPanel.setLayout(new BorderLayout()); JScrollPane areaScrollPane = new JScrollPane(resultsTextArea); resultsTextArea.setEditable(false); areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(600, 300)); resultsPanel.add(makeMatchList(), BorderLayout.WEST); resultsPanel.add(areaScrollPane, BorderLayout.CENTER); return resultsPanel; }
private void displayTsurgeonHelp() { if(tsurgeonHelpFrame != null) { tsurgeonHelpFrame.setVisible(true); } else { tsurgeonHelpFrame = new JFrame("TSurgeon Help..."); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlTsurgeonHelp); helpText.setText(htmlTsurgeonHelp); helpText.setEditable(false); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); tsurgeonHelpFrame.add(scroller); tsurgeonHelpFrame.pack(); tsurgeonHelpFrame.setBackground(Color.WHITE); tsurgeonHelpFrame.setVisible(true); } }
private void setGUISize() { textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight));
private JComponent getCenterPanel() { JPanel center = new JPanel(new BorderLayout()); center.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); center.setBackground(Color.WHITE); JTextArea license = new javax.swing.JTextArea(); license.setLineWrap(true); license.setWrapStyleWord(true); license.setEditable(false); license.setFont(license.getFont().deriveFont(11.0f)); StringBuilder licenseText = new StringBuilder(); licenseText.append("Enhance current Java (JRE/JDK) installations with DCEVM (http://github.com/dcevm/dcevm)."); licenseText.append("\n\nYou can either replace current Java VM or install DCEVM as alternative JVM (run with -XXaltjvm=dcevm command-line option)."); licenseText.append("\nInstallation as alternative JVM is preferred, it gives you more control where you will use DCEVM.\nWhy this is important? Because DCEVM forces your JVM to use only one GC algorithm, and this may cause performance penalty."); licenseText.append("\n\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA."); licenseText.append("\n\n\nASM LICENSE TEXT:\nCopyright (c) 2000-2005 INRIA, France Telecom\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); license.setText(licenseText.toString()); JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); licenses.setPreferredSize(new Dimension(150, 150)); center.add(licenses, BorderLayout.NORTH); center.add(getChooserPanel(), BorderLayout.CENTER); return center; }
private void displayHelp() { if (helpFrame != null) { helpFrame.setVisible(true); } else { helpFrame = new JFrame("Tregex Help..."); //JPanel helpPanel = new JPanel(); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlHelp); helpText.setText(htmlHelp); helpText.setEditable(false); //helpPanel.add(helpText); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); helpFrame.add(scroller); helpFrame.pack(); helpFrame.setBackground(Color.WHITE); helpFrame.setVisible(true); //helpFrame.repaint(); } }
private JComponent createQuickOpenPanel(JList<QuickOpenAction> listPanel, String title, List<File> fileList) { listPanel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listPanel.addListSelectionListener(event -> { if (event.getValueIsAdjusting()) { return; } int selectedIndex = listPanel.getSelectedIndex(); if (selectedIndex < 0) { return; } QuickOpenAction action = listPanel.getModel().getElementAt(selectedIndex); action.actionPerformed(new ActionEvent(listPanel, -1, null)); }); refreshQuickOpenPanel(listPanel, fileList); JScrollPane scrollPane = new JScrollPane(listPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JLabel titleLabel = new JLabel(title); titleLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titlePanel.add(titleLabel, BorderLayout.NORTH); titlePanel.add(scrollPane, BorderLayout.CENTER); return titlePanel; }
final JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBorder(BorderFactory.createTitledBorder("Events: ")); scrollPane.setPreferredSize(new Dimension(900, 300)); details.setPreferredSize(new Dimension(900, 300));
public OptionsFontPanel(){ JPanel jp = this; jp.setLayout(new BorderLayout()); jp_north.add(jb_default); jp.add(jp_north, BorderLayout.NORTH); final int _H = 100; Dimension d = new Dimension(_W, _H); JPanel jp_center = new JPanel(); jp_center.setLayout(new GridLayout(1, 2)); String[] fontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); jl_font = new JList<String>(fontFamilyNames); jl_font.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_font.addListSelectionListener(previewListner); JScrollPane jsp_font = new JScrollPane(jl_font); jsp_font.setPreferredSize(d); jl_fontSize.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_fontSize.addListSelectionListener(previewListner); JScrollPane jsp_fontSize = new JScrollPane(jl_fontSize); jsp_fontSize.setPreferredSize(d); JPanel jp_south = new JPanel(); jp_south.setBorder(BorderFactory.createLineBorder(Color.BLACK)); jp_south.setPreferredSize(new Dimension(_W, _H / 2));
tabbedPane.setPreferredSize(new Dimension(500, 7)); splitPane.setRightComponent(tabbedPane); componentDetailsTab = new JScrollPane(); tabbedPane.addTab("Component details", null, componentDetailsTab, null); componentDetailsTab.setViewportView(componentEditor); sourceTab = new JScrollPane(); tabbedPane.addTab("Source", null, sourceTab, null); sourceTab.setRowHeaderView(textLineNumber); highlightingTab = new JScrollPane(); tabbedPane.addTab("Highlighting", null, highlightingTab, null); treeScrollPane = new JScrollPane(); treeScrollPane.setPreferredSize(new Dimension(200, 400)); splitPane.setLeftComponent(treeScrollPane);
private JComponent getChooserPanel() { JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); p.setOpaque(false); JLabel l = new JLabel("Please choose installation directory:"); l.setVerticalAlignment(JLabel.NORTH); l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); p.add(l, BorderLayout.NORTH); table = new JTable(installations); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setColumnSelectionAllowed(false); table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer()); table.getColumnModel().getColumn(0).setHeaderValue("Directory"); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setHeaderValue("Java Version"); table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(2).setHeaderValue("Type"); table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(3).setHeaderValue("Replaced by DCEVM?"); table.getColumnModel().getColumn(3).setPreferredWidth(200); table.getColumnModel().getColumn(4).setHeaderValue("Installed altjvm?"); table.getColumnModel().getColumn(4).setPreferredWidth(200); JScrollPane lists = new JScrollPane(table); lists.setPreferredSize(new Dimension(900, 200)); p.add(lists, BorderLayout.CENTER); return p; }
JScrollPane detailTAScrollPane = new JScrollPane(detailTA); _table = new LogTable(detailTA); setView(_currentView, _table); _table.setFont(new Font(_fontName, Font.PLAIN, _fontSize)); _logTableScrollPane = new JScrollPane(_table); new JScrollPane(_categoryExplorerTree); categoryExplorerTreeScrollPane.setPreferredSize(new Dimension(130, 400));
/** * @param gcResource resource to be tracked */ public GCModelLoaderView(GCResource gcResource) { super(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel parserInfo = new JPanel(new FlowLayout(FlowLayout.LEFT)); progressBar = new JProgressBar(0, 100); progressBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); progressBar.setVisible(true); progressBar.setValue(0); progressBar.setStringPainted(true); cancelButton = new JButton(new SquareIcon()); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(this); messageLabel = new JLabel(); messageLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); messageLabel.setVisible(false); parserInfo.add(progressBar); parserInfo.add(cancelButton); parserInfo.add(messageLabel); add(parserInfo, BorderLayout.NORTH); JTextArea textArea = textAreaLogHandler.getTextArea(); textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); JScrollPane textAreaScrollPane = new JScrollPane(textArea); textAreaScrollPane.setPreferredSize(new Dimension(700, 500)); add(textAreaScrollPane, BorderLayout.CENTER); setGCResource(gcResource); }
JScrollPane textPane = new JScrollPane(textArea); textPane.setPreferredSize(new Dimension(500, 400)); add(textPane);
public CloudProcessListDialog() { setModal(true); setTitle(getComputerLabel()); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BorderLayout()); contentPanel.add(createHeaderPanel(), BorderLayout.NORTH); JPanel assignmentsPanel = createAssignmentsPanel(); JScrollPane assignmentsScrollPane = new JScrollPane(assignmentsPanel); assignmentsScrollPane.setPreferredSize(new Dimension(800, 400)); assignmentsScrollPane.getVerticalScrollBar().setUnitIncrement(20); contentPanel.add(assignmentsScrollPane, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout()); Action okAction = new AbstractAction("Ok") { @Override public void actionPerformed(ActionEvent e) { dispose(); } }; buttonPanel.add(new JButton(okAction)); contentPanel.add(buttonPanel, BorderLayout.SOUTH); setContentPane(contentPanel); pack(); }