Java Code Examples for javax.swing.JScrollPane#setBounds()
The following examples show how to use
javax.swing.JScrollPane#setBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommunityDialog.java From WorldGrower with GNU General Public License v3.0 | 6 votes |
private void createAcquaintancesPanel(WorldObject playerCharacter, ImageInfoReader imageInfoReader, World world, int infoPanelWidth, int infoPanelHeight, JPanel infoPanel) { JPanel acquaintancesPanel = JPanelFactory.createJPanel("Acquaintances"); acquaintancesPanel.setLayout(null); acquaintancesPanel.setBounds(12, 363, infoPanelWidth + 5, infoPanelHeight); infoPanel.add(acquaintancesPanel, ACQUAINTANCES_KEY); tblAcquaintances = JTableFactory.createJTable(new AcquaintancesTableModel(playerCharacter, world)); tblAcquaintances.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader)); tblAcquaintances.setRowHeight(50); tblAcquaintances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblAcquaintances.setAutoCreateRowSorter(true); tblAcquaintances.getColumnModel().getColumn(0).setPreferredWidth(50); tblAcquaintances.getColumnModel().getColumn(1).setPreferredWidth(100); tblAcquaintances.getColumnModel().getColumn(2).setPreferredWidth(100); tblAcquaintances.getColumnModel().getColumn(3).setPreferredWidth(100); tblAcquaintances.getColumnModel().getColumn(4).setPreferredWidth(100); JScrollPane scrollPaneAcquaintances = JScrollPaneFactory.createScrollPane(tblAcquaintances); scrollPaneAcquaintances.setBounds(12, 30, 525, 420); acquaintancesPanel.add(scrollPaneAcquaintances); SwingUtils.makeTransparant(tblAcquaintances, scrollPaneAcquaintances); }
Example 2
Source File: GroupWindow.java From egdownloader with GNU General Public License v2.0 | 6 votes |
public GroupWindow(List<File> groups, final EgDownloaderWindow mainWindow){ super(Version.NAME + "任务组列表"); this.mainWindow = mainWindow; this.setSize(300, 400); this.setResizable(false); this.setIconImage(IconManager.getIcon("group").getImage()); this.setLocationRelativeTo(null); this.getContentPane().setLayout(null); this.setDefaultCloseOperation(mainWindow == null ? EXIT_ON_CLOSE : DISPOSE_ON_CLOSE); JLabel tipLabel = new AJLabel("双击选择任务组", new Color(67,44,1), 15, 15, 100, 30); JButton addGroupBtn = new AJButton("新建", IconManager.getIcon("add"), new OperaBtnMouseListener(this, MouseAction.CLICK, new IListenerTask() { public void doWork(Window window, MouseEvent e) { new AddGroupDialog((GroupWindow) window, mainWindow); } }) , 215, 15, 62, 30); addGroupBtn.setUI(AJButton.blueBtnUi); JList list = new GroupList(groups, this, mainWindow); list.setSelectedIndex(0); JScrollPane listPane = new JScrollPane(list); listPane.setBounds(new Rectangle(10, 50, 270, 300)); listPane.setAutoscrolls(true); listPane.getViewport().setBackground(new Color(254,254,254)); ComponentUtil.addComponents(this.getContentPane(), tipLabel, addGroupBtn, listPane); this.setVisible(true); }
Example 3
Source File: FilterPanel.java From dkpro-jwpl with Apache License 2.0 | 6 votes |
/** * Initialize JTable that contains namespaces */ private void initTable() { namespaces = new JTable(new FilterTableModel()); namespaces.removeColumn(namespaces.getColumn("#")); namespaces.setFillsViewportHeight(true); namespaces.setPreferredScrollableViewportSize(new Dimension(500, 70)); // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(namespaces); scrollPane.setBounds(70, 10, 300, 200); this.add(scrollPane); }
Example 4
Source File: License.java From DTMF-Decoder with MIT License | 6 votes |
/** * Create the frame. */ public License() { setTitle("License"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(100, 100, 450, 300); setResizable(false); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(5, 5, 434, 265); contentPane.add(scrollPane); JTextArea txtrTheMitLicense = new JTextArea(); scrollPane.setViewportView(txtrTheMitLicense); txtrTheMitLicense.setLineWrap(true); txtrTheMitLicense.setEditable(false); txtrTheMitLicense.setWrapStyleWord(true); txtrTheMitLicense.setText("The MIT License (MIT)\n\nCopyright (c) 2015 Tinotenda Chemvura\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."); }
Example 5
Source File: OverviewPanel.java From blog with Apache License 2.0 | 5 votes |
public OverviewPanel() { setLayout(null); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); treeSelectionListModelSelectionAdapter .setListModelSelection(listModelSelection); personList.setSelectionModel(selectionModel); personTable.setSelectionModel(selectionModel); personComboBoxModel.setListSelectionModel(selectionModel); personTree.setSelectionModel(treeSelectionListModelSelectionAdapter); ListCellRenderer<Person> personRenderer = new PersonListCellRenderer(); personList.setCellRenderer(personRenderer); personList.setEnabled(true); personsComboBox.setRenderer(personRenderer); personTree.setCellRenderer(new PersonTreeCellRenderer()); personTree.setRootVisible(false); personTable.setSelectionModel(personList.getSelectionModel()); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 580, 130); add(scrollPane); scrollPane.setViewportView(personTable); personsComboBox.setBounds(10, 153, 580, 30); add(personsComboBox); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(10, 194, 580, 105); add(scrollPane_1); scrollPane_1.setViewportView(personList); JScrollPane scrollPane_2 = new JScrollPane(); scrollPane_2.setBounds(10, 310, 580, 205); add(scrollPane_2); scrollPane_2.setColumnHeaderView(personTree); }
Example 6
Source File: ChooseKnowledgeDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void initializeGui(Component parent, List<KnowledgeDescription> knowledgeDescriptions, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, JFrame parentFrame) { knowledgeTable = JTableFactory.createJTable(new KnowledgeModel(knowledgeDescriptions)); knowledgeTable.setDefaultRenderer(ImageIds.class, new ImageCellRenderer(imageInfoReader)); knowledgeTable.setDefaultRenderer(String.class, new DefaultTableCellRenderer()); knowledgeTable.setRowHeight(50); knowledgeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); knowledgeTable.getColumnModel().getColumn(0).setPreferredWidth(30); knowledgeTable.getColumnModel().getColumn(1).setPreferredWidth(50); knowledgeTable.getColumnModel().getColumn(2).setPreferredWidth(500); knowledgeTable.getColumnModel().getColumn(0).setHeaderValue(" "); knowledgeTable.getColumnModel().getColumn(1).setHeaderValue(" "); knowledgeTable.getColumnModel().getColumn(2).setHeaderValue(" "); knowledgeTable.getTableHeader().setReorderingAllowed(false); JScrollPane scrollPane = JScrollPaneFactory.createScrollPane(knowledgeTable); scrollPane.setBounds(5, 5, 585, 510); this.addComponent(scrollPane); SwingUtils.makeTransparant(knowledgeTable, scrollPane); JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.setBounds(5, 540, 585, 40); buttonPane.setOpaque(false); this.addComponent(buttonPane); okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader); okButton.setActionCommand("OK"); buttonPane.add(okButton, BorderLayout.EAST); getRootPane().setDefaultButton(okButton); DialogUtils.createDialogBackPanel(this, parentFrame.getContentPane()); }
Example 7
Source File: CommunityDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void createRanksPanel(WorldObject playerCharacter, World world, int infoPanelWidth, int infoPanelHeight, JPanel infoPanel) { JPanel ranksPanel = JPanelFactory.createJPanel("Player Character Ranks"); ranksPanel.setLayout(null); ranksPanel.setBounds(510, 13, infoPanelWidth + 5, infoPanelHeight); infoPanel.add(ranksPanel, RANKS_KEY); OrganizationsModel worldModel = new OrganizationsModel(playerCharacter, world); JTable organizationsTable = JTableFactory.createJTable(worldModel); organizationsTable.setRowHeight(30); JScrollPane scrollPane = JScrollPaneFactory.createScrollPane(organizationsTable); scrollPane.setBounds(15, 30, 525, 420); ranksPanel.add(scrollPane); SwingUtils.makeTransparant(organizationsTable, scrollPane); }
Example 8
Source File: DemandsDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
public void initializeGUI(ImageInfoReader imageInfoReader, SoundIdReader soundIdReader) { DemandsModel worldModel = new DemandsModel(demands); JTable table = JTableFactory.createJTable(worldModel); table.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader)); table.setAutoCreateRowSorter(true); table.setRowHeight(50); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getColumnModel().getColumn(0).setPreferredWidth(100); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(100); table.getRowSorter().toggleSortOrder(1); TableCellEditor fce = new PositiveIntegerCellEditor(JTextFieldFactory.createJTextField()); table.setDefaultEditor(Integer.class, fce); JScrollPane scrollPane = JScrollPaneFactory.createScrollPane(table); scrollPane.setBounds(15, 15, 418, 700); addComponent(scrollPane); JPanel buttonPane = new JPanel(); buttonPane.setOpaque(false); buttonPane.setBounds(0, 720, 428, 75); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); addComponent(buttonPane); JButton okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader); okButton.setActionCommand("OK"); buttonPane.add(okButton); addActionHandlers(okButton, worldModel, this, demands); getRootPane().setDefaultButton(okButton); SwingUtils.makeTransparant(table, scrollPane); }
Example 9
Source File: PricesDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
public void initializeGUI(Consumer<int[]> setPricesAction, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader) { PricesModel worldModel = new PricesModel(pricesOnPlayer); JTable table = JTableFactory.createJTable(worldModel); table.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader)); table.setRowHeight(50); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getColumnModel().getColumn(0).setPreferredWidth(100); table.getColumnModel().getColumn(1).setPreferredWidth(250); table.getColumnModel().getColumn(2).setPreferredWidth(100); JTableFactory.applyImageToHeaderColumn(table, table.getColumnModel().getColumn(2), ImageIds.SMALL_GOLD_COIN, imageInfoReader); table.setAutoCreateRowSorter(true); table.getRowSorter().toggleSortOrder(1); JScrollPane scrollPane = JScrollPaneFactory.createScrollPane(table); scrollPane.setBounds(15, 15, 468, 700); addComponent(scrollPane); JPanel buttonPane = new JPanel(); buttonPane.setOpaque(false); buttonPane.setBounds(0, 730, 488, 75); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); addComponent(buttonPane); JButton okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader); okButton.setActionCommand("OK"); buttonPane.add(okButton); addActionHandlers(setPricesAction, okButton, worldModel, this, pricesOnPlayer); getRootPane().setDefaultButton(okButton); SwingUtils.makeTransparant(table, scrollPane); }
Example 10
Source File: ControlsDialog.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private void addKeyBindingsTable(KeyBindings keyBindings) { JTable table = JTableFactory.createJTable(new ControlsTableModel(keyBindings)); JComboBox<Character> comboBox = JComboBoxFactory.createJComboBox(new Character[]{'A', 'B', 'C'}, imageInfoReader); table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(comboBox)); table.setRowHeight(25); table.getColumnModel().getColumn(0).setPreferredWidth(250); table.getColumnModel().getColumn(1).setPreferredWidth(50); comboBox.setRenderer(new TextComboBoxRenderer<Character>(SwingConstants.CENTER)); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent event) { if (table.getSelectedRow() > -1) { comboBox.setModel(new DefaultComboBoxModel<>(keyBindings.getPossibleValues(table.getSelectedRow()).toArray(new Character[0]))); comboBox.setSelectedItem(table.getValueAt(table.getSelectedRow(), 1)); } } }); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(15, 15, 368, 280); addComponent(scrollPane); SwingUtils.makeTransparant(table, scrollPane); }
Example 11
Source File: ConfigDialog.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
/** * Creates the JTable for displaying the input archives. */ private void createItemTable() { itemTable = new JTable(controller.getConfigErrors()); itemTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); itemScrollPane = new JScrollPane(itemTable); itemScrollPane.setBounds(10, 10, 470, 180); this.add(itemScrollPane); }
Example 12
Source File: PanamaHitek_DataBuffer.java From PanamaHitek_Arduino with GNU Lesser General Public License v3.0 | 5 votes |
/** * Construye un JTable y la inserta dentro de un JPanel * * @param panel JPanel donde se desea insertar la tabla */ public void insertToPanel(JPanel panel) { buildTable(); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); scroll = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);; scroll.setViewportView(table); scroll.setVisible(true); scroll.setBounds(0, 0, panel.getWidth(), panel.getHeight() - 25); tableFlag = true; panel.add(scroll); }
Example 13
Source File: LogManagerPanel.java From software-demo with MIT License | 5 votes |
/** * Create the panel. */ public LogManagerPanel() { setBounds(0, 0, 1165, 725); setLayout(null); JButton btnNewButton = new JButton("日志刷新"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //重新加载日志 initData(); } }); btnNewButton.setBounds(29, 29, 93, 23); add(btnNewButton); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBounds(10, 81, 1145, 611); panel.setBorder(BorderFactory.createTitledBorder("日志列表:")); add(panel); panel.setLayout(null); textArea = new JTextArea(); textArea.setForeground(Color.GREEN); textArea.setBackground(Color.BLACK); textArea.setFont(new Font("Monospaced", Font.PLAIN, 17)); JScrollPane js = new JScrollPane(textArea); js.setBounds(25, 25, 1100, 570); panel.add(js); initData(); }
Example 14
Source File: Solver.java From algorithms-nutshell-2ed with MIT License | 4 votes |
public static void main(String[] args) throws Exception { // solution found. Create GUI. final JFrame frame = new JFrame(); frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { /** Once opened: load up the images. */ public void windowOpened(WindowEvent e) { System.out.println("Loading card images..."); cardImages = CardImagesLoader.getDeck(e.getWindow()); } }); frame.setSize(808,350); JList<IMove> list = new JList<IMove>(); // add widgets at proper location frame.setLayout(null); // top row: JPanel topLeft = new JPanel(); topLeft.setBounds(0, 0, 400, 40); topLeft.add(new JLabel("Select Game:")); final JTextField jtf = new JTextField (7); topLeft.add(jtf); frame.add(topLeft); JPanel topRight = new JPanel(); topRight.setBounds(400, 0, 400, 40); String instructions = "Select moves from below list to see game state at that moment."; topRight.add(new JLabel(instructions)); frame.add(topRight); // bottom row FreeCellDrawing drawer = new FreeCellDrawing(); drawer.setBounds (0, 40, 400, 275); drawer.setBackground(new java.awt.Color (0,128,0)); frame.add(drawer); // Create the GUI and put it in the window with scrollbars. JScrollPane scrollingPane = new JScrollPane(list); scrollingPane.setAutoscrolls(true); scrollingPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollingPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollingPane.setBounds(400, 40, 400, 275); frame.add(scrollingPane); // set up listeners and show everything jtf.addActionListener(new DealController(frame, drawer, list)); frame.setVisible(true); }
Example 15
Source File: AboutDialog.java From dualsub with GNU General Public License v3.0 | 4 votes |
private void initComponents() { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle(I18N.getText("Window.name.text")); // Features this.setResizable(false); getContentPane().setLayout(null); this.getContentPane().setBackground(parent.getBackground()); // Tabs JTabbedPane tabs = new JTabbedPane(); tabs.setBounds(10, 11, 474, 351); this.getContentPane().add(tabs); // About tab JPanel aboutTab = new JPanel(); aboutTab.setBackground(parent.getBackground()); tabs.addTab(I18N.getHtmlText("About.about.text"), aboutTab); aboutTab.setLayout(null); JLabel lblDualSub = new JLabel(); lblDualSub.setIcon(new ImageIcon(ClassLoader .getSystemResource("img/dualsub-about.png"))); lblDualSub.setBounds(66, 0, 330, 140); aboutTab.add(lblDualSub); scrollPane = new JScrollPane(); scrollPane.setBounds(0, 139, 470, 187); aboutTab.add(scrollPane); JTextPane txtrDualSub = new JTextPane(); scrollPane.setViewportView(txtrDualSub); txtrDualSub.setContentType("text/html"); addTextContentToArea(txtrDualSub, "README.md", true); txtrDualSub.setEditable(false); tabs.setVisible(true); // Changelog tab JPanel changelogTab = new JPanel(); changelogTab.setBackground(parent.getBackground()); changelogTab.setLayout(null); tabs.addTab(I18N.getHtmlText("About.changelog.text"), null, changelogTab, null); scrollChangelog = new JScrollPane(); scrollChangelog.setBounds(0, 0, 470, 327); changelogTab.add(scrollChangelog); JTextPane txtChangelog = new JTextPane(); scrollChangelog.setViewportView(txtChangelog); addTextContentToArea(txtChangelog, "changelog", false); txtChangelog.setEditable(false); // License tab JPanel licenseTab = new JPanel(); licenseTab.setBackground(parent.getBackground()); licenseTab.setLayout(null); tabs.addTab(I18N.getHtmlText("About.license.text"), null, licenseTab, null); scrollLicense = new JScrollPane(); scrollLicense.setBounds(0, 0, 470, 327); licenseTab.add(scrollLicense); JTextPane txtLicense = new JTextPane(); scrollLicense.setViewportView(txtLicense); addTextContentToArea(txtLicense, "LICENSE", false); txtLicense.setEditable(false); JButton btnOk = new JButton(I18N.getHtmlText("About.ok.text")); btnOk.setBounds(203, 373, 89, 23); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); this.getContentPane().add(btnOk); }
Example 16
Source File: RouterClientTest.java From jRUDP with MIT License | 4 votes |
private RouterClientTest() { setResizable(false); setTitle("jRUDP Client Test"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(289, 500); setLocationRelativeTo(null); getContentPane().setLayout(null); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) {} JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 69, 263, 156); getContentPane().add(scrollPane); lblRecPacketQueue = new JLabel("Received Packet Queue (Front==index#0)"); scrollPane.setColumnHeaderView(lblRecPacketQueue); JList<String> listPacketQueue = new JList<>(); listPacketQueue.setEnabled(false); listPacketQueue.setModel(modelRecPackets); scrollPane.setViewportView(listPacketQueue); btnConnection = new JButton("Connect"); btnConnection.addActionListener((action)->{ if(clientInstance != null && clientInstance.isConnected()) { disconnectWGui(); } else { connectWGui(); } }); btnConnection.setBounds(10, 438, 263, 23); getContentPane().add(btnConnection); tfServerPort = new JTextField(); tfServerPort.setText(ST_SERVER_PORT + ""); tfServerPort.setBounds(96, 407, 177, 20); tfServerPort.setColumns(10); getContentPane().add(tfServerPort); tfServerHost = new JTextField(); tfServerHost.setText(ST_SERVER_HOST); tfServerHost.setColumns(10); tfServerHost.setBounds(96, 376, 177, 20); getContentPane().add(tfServerHost); JLabel lblServerHost = new JLabel("Server Host:"); lblServerHost.setBounds(23, 379, 71, 14); getContentPane().add(lblServerHost); JLabel lblServerPort = new JLabel("Server Port:"); lblServerPort.setBounds(23, 410, 71, 14); getContentPane().add(lblServerPort); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane_1.setBounds(10, 236, 263, 126); getContentPane().add(scrollPane_1); taConsole = new JTextArea(); taConsole.setLineWrap(true); taConsole.setWrapStyleWord(true); taConsole.setEditable(false); taConsole.setBackground(Color.LIGHT_GRAY); taConsole.setFont(new Font("SansSerif", Font.BOLD, 11)); scrollPane_1.setViewportView(taConsole); taHandledPacket = new JTextArea(); taHandledPacket.setEditable(false); taHandledPacket.setEnabled(false); taHandledPacket.setFont(new Font("SansSerif", Font.BOLD, 11)); taHandledPacket.setText("Last Handled Packet:\r\nnull"); taHandledPacket.setBounds(10, 11, 263, 47); getContentPane().add(taHandledPacket); setVisible(true); System.setOut(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { taConsole.append("" + (char)b); taConsole.setSize(taConsole.getPreferredSize()); JScrollBar sb = scrollPane_1.getVerticalScrollBar(); sb.setValue( sb.getMaximum() ); } })); System.out.println("[INFO]Console: on"); setVisible(true); }
Example 17
Source File: TesteComponentes.java From dctb-utfpr-2018-1 with Apache License 2.0 | 4 votes |
public void TesteComponente(){ janela.setVisible(true); janela.setSize(DIMENSOES); janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JScrollPane teste1 = new JScrollPane(painel); teste1.setBounds(1, 2, 150, 200); JButton teste2 = new JButton("Aperte"); teste2.setBounds(210, 2, 100, 100); JToggleButton teste3 = new JToggleButton("Toggle"); teste3.setBounds(320, 2, 100, 100); JCheckBox teste4 = new JCheckBox("Teste"); teste4.setBounds(430, 2, 100, 100); JRadioButton teste5 = new JRadioButton("Teste2"); teste5.setBounds(540, 2, 100, 100); JTextField teste6 = new JTextField(); teste6.setToolTipText("Seu Nome"); teste6.setBounds(1, 205, 200, 50); String[] numeros = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; JList teste7 = new JList(numeros); JScrollPane teste7_2 = new JScrollPane(teste7); teste7_2.setBounds(210, 205, 100, 100); String[] numeros2 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; JComboBox teste8 = new JComboBox(numeros2); teste8.setBounds(320, 205, 50, 50); JLabel teste9 = new JLabel(); teste9.setText("Biografia: "); teste9.setBounds(1, 290, 200, 100); JTextArea teste10 = new JTextArea(); teste10.setToolTipText("Biografia"); teste10.setBounds(1, 350, 100, 100); teste2.addActionListener(this); teste3.addActionListener(this); teste4.addActionListener(this); teste5.addActionListener(this); janela.add(teste1); janela.add(teste2); janela.add(teste3); janela.add(teste4); janela.add(teste5); janela.add(teste6); janela.add(teste7); janela.add(teste8); janela.add(teste9); janela.add(teste10); }
Example 18
Source File: MagicOverviewDialog.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
public MagicOverviewDialog(WorldObject playerCharacter, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, JFrame parentFrame) { setModalityType(ModalityType.APPLICATION_MODAL); contentPanel = new TiledImagePanel(imageInfoReader); int width = 900; int height = 850; setSize(width, height); contentPanel.setPreferredSize(new Dimension(width, height)); setLocationRelativeTo(null); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); setUndecorated(true); IconUtils.setIcon(this); setCursor(Cursors.CURSOR); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(12, 13, 871, 767); contentPanel.add(scrollPane); JTable magicSpellsTable = new MagicSpellsTable(new MagicSpellTableModel(playerCharacter)); magicSpellsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); magicSpellsTable.setDefaultRenderer(SkillProperty.class, new SkillTableRenderer(imageInfoReader)); magicSpellsTable.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader)); magicSpellsTable.setRowHeight(50); magicSpellsTable.setAutoCreateRowSorter(true); magicSpellsTable.getRowSorter().toggleSortOrder(1); magicSpellsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); magicSpellsTable.getColumnModel().getColumn(0).setPreferredWidth(50); magicSpellsTable.getColumnModel().getColumn(1).setPreferredWidth(257); magicSpellsTable.getColumnModel().getColumn(2).setPreferredWidth(150); magicSpellsTable.getColumnModel().getColumn(3).setPreferredWidth(145); magicSpellsTable.getColumnModel().getColumn(4).setPreferredWidth(100); magicSpellsTable.getColumnModel().getColumn(5).setPreferredWidth(150); JTableFactory.applyImageToHeaderColumn(magicSpellsTable, magicSpellsTable.getColumnModel().getColumn(5), ImageIds.SMALL_TURN, imageInfoReader); scrollPane.setViewportView(magicSpellsTable); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttonPane.setOpaque(false); buttonPane.setBounds(12, 790, 878, 75); contentPanel.add(buttonPane); JButton okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); okButton.addActionListener(new CloseDialogAction()); SwingUtils.installEscapeCloseOperation(this); SwingUtils.makeTransparant(magicSpellsTable, scrollPane); DialogUtils.createDialogBackPanel(this, parentFrame.getContentPane()); }
Example 19
Source File: DownloadWindow.java From xdm with GNU General Public License v2.0 | 4 votes |
private void createP2() { remove(prgCircle); remove(lblSpeed); remove(lblStat); remove(segProgress); remove(lblDet); remove(lblETA); remove(this.panel); titlePanel.remove(closeBtn); titlePanel.remove(minBtn); JPanel p2 = new JPanel(null); p2.setBounds(0, getScaledInt(60), getScaledInt(350), getScaledInt(190)); p2.setBackground(ColorResource.getDarkestBgColor()); txtError = new JTextArea();// this.errMsg); txtError.setFont(FontResource.getBigFont()); txtError.setEditable(false); txtError.setCaretPosition(0); txtError.setWrapStyleWord(true); txtError.setLineWrap(true); txtError.setBackground(ColorResource.getDarkestBgColor()); txtError.setForeground(Color.WHITE); JScrollPane jsp = new JScrollPane(txtError); jsp.setBounds(getScaledInt(25), getScaledInt(20), getScaledInt(300), getScaledInt(100)); jsp.setBorder(null); CustomButton exitBtn = new CustomButton(); exitBtn.setText(StringResource.get("MSG_OK")); applyStyle(exitBtn); exitBtn.setBounds(0, 1, getScaledInt(350), getScaledInt(50)); exitBtn.setName("EXIT"); JPanel panel2 = new JPanel(null); panel2.setBounds(0, getScaledInt(140), getScaledInt(350), getScaledInt(50)); panel2.setBackground(Color.DARK_GRAY); panel2.add(exitBtn); p2.add(jsp); p2.add(panel2); add(p2); titleLbl.setText(StringResource.get("MSG_FAILED")); invalidate(); repaint(); }
Example 20
Source File: ExceptionDialog.java From dualsub with GNU General Public License v3.0 | 4 votes |
private void initComponents() { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle(I18N.getText("Window.name.text")); // Features this.setResizable(false); getContentPane().setLayout(null); this.getContentPane().setBackground(parent.getBackground()); JLabel lblTitle = new JLabel(I18N.getText("ExceptionDialog.text.01")); lblTitle.setFont(new Font("Lucida", Font.BOLD, 20)); lblTitle.setBounds(29, 21, 435, 25); getContentPane().add(lblTitle); JLabel lblContent01 = new JLabel( I18N.getHtmlText("ExceptionDialog.text.02")); lblContent01.setBounds(29, 69, 435, 50); getContentPane().add(lblContent01); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(28, 130, 435, 150); getContentPane().add(scrollPane); JTextArea textArea = new JTextArea(); scrollPane.setViewportView(textArea); textArea.append(exception.getClass() + ":" + exception.getMessage() + "\n"); StackTraceElement[] stack = exception.getStackTrace(); for (StackTraceElement s : stack) { textArea.append(" " + s.toString() + "\n"); } JLabel lblContent02 = new JLabel( I18N.getHtmlText("ExceptionDialog.text.03")); lblContent02.setBounds(29, 290, 435, 90); getContentPane().add(lblContent02); // Borders (for debug purposes) if (log.isTraceEnabled()) { Border border = BorderFactory.createLineBorder(Color.black); lblTitle.setBorder(border); lblContent01.setBorder(border); lblContent02.setBorder(border); } }