Java Code Examples for javax.swing.JTextArea#setBounds()
The following examples show how to use
javax.swing.JTextArea#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: InlineGMLPreviewPanel.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the UI. * * @param noOfRows the no of rows */ private void createUI(int noOfRows) { setLayout(new BorderLayout()); int xPos = 0; int width = BasePanel.FIELD_PANEL_WIDTH - xPos - 20; int height = BasePanel.WIDGET_HEIGHT * (noOfRows - 1); this.setBounds(0, 0, width, height); textField = new JTextArea(); textField.setBounds(xPos, BasePanel.WIDGET_HEIGHT, width, height); Font font = textField.getFont(); // Create a new, smaller font from the current font Font updatedFont = new Font(font.getFontName(), font.getStyle(), FONT_SIZE); // Set the new font in the editing area textField.setFont(updatedFont); textField.setEditable(true); // Wrap the text field with a scroll pane JScrollPane scroll = new JScrollPane(textField); scroll.setAutoscrolls(true); add(scroll, BorderLayout.CENTER); }
Example 2
Source File: MotionDemo.java From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License | 5 votes |
private JComponent buildContentPane() { JPanel panel = new JPanel(null); int x = 16; int y = 16; Dimension size; textArea = new JTextArea("Type your document here.", 12, 25); textArea.setBorder(BorderFactory.createLineBorder(Color.BLACK)); size = textArea.getPreferredSize(); textArea.setBounds(x, y, size.width, size.height); panel.add(textArea); x += size.width + 6; saveButton = new JButton("Save..."); size = saveButton.getPreferredSize(); saveButton.setBounds(x, y, size.width, size.height); panel.add(saveButton); y += size.height + 4; openButton = new JButton("Open..."); size = openButton.getPreferredSize(); openButton.setBounds(x, y, size.width, size.height); panel.add(openButton); x += size.width + 16; y = textArea.getPreferredSize().height + 16 + 16; panel.setPreferredSize(new Dimension(x, y)); return panel; }
Example 3
Source File: MassageOk.java From JAVA-MVC-Swing-Monopoly with Apache License 2.0 | 5 votes |
private void addTextArea() { textArea = new JTextArea(); textArea.setText("���˸�ȥ����"); textArea.setBounds(18, 39, 230, 50); textArea.setSelectedTextColor(Color.BLUE); textArea.setOpaque(false); textArea.setEditable(false); textArea.setLineWrap(true); add(textArea); }
Example 4
Source File: MassageSimple.java From JAVA-MVC-Swing-Monopoly with Apache License 2.0 | 5 votes |
private void addTextArea() { textArea = new JTextArea(); textArea.setText("���˸�ȥ����"); textArea.setBounds(18, 39, 230, 50); textArea.setSelectedTextColor(Color.BLUE); textArea.setOpaque(false); textArea.setEditable(false); textArea.setLineWrap(true); add(textArea); }
Example 5
Source File: MassageYesNo.java From JAVA-MVC-Swing-Monopoly with Apache License 2.0 | 5 votes |
private void addTextArea() { textArea = new JTextArea(); textArea.setText("���˸�ȥ����"); textArea.setBounds(18, 39, 230, 50); textArea.setSelectedTextColor(Color.BLUE); textArea.setOpaque(false); textArea.setEditable(false); textArea.setLineWrap(true); add(textArea); }
Example 6
Source File: AbstractDataMonitorView.java From ET_Redux with Apache License 2.0 | 5 votes |
private void rawDataFilePathTextFactory() throws IOException { // show rawdatafile path rawDataFilePathTextArea = new JTextArea(// "Monitoring Raw data location: " + rawDataFileHandler.getAcquisitionModel().getRawDataFile().getCanonicalPath()); rawDataFilePathTextArea.setBounds(leftMargin + 50, topMargin, parentDimension.width - 100, 40); rawDataFilePathTextArea.setLineWrap(true); rawDataFilePathTextArea.setEditable(false); rawDataFilePathTextArea.setForeground(Color.RED); this.add(rawDataFilePathTextArea, JLayeredPane.DEFAULT_LAYER); }
Example 7
Source File: UI.java From PewCrypt with MIT License | 4 votes |
/** * Initialise the contents of the frame. */ private void initialize() { byte[] imageBytes = DatatypeConverter.parseBase64Binary(imgB64); try { img = ImageIO.read(new ByteArrayInputStream(imageBytes)); } catch (IOException e1) { e1.printStackTrace(); } frmYourFilesHave = new JFrame(); frmYourFilesHave.setResizable(false); frmYourFilesHave.setIconImage(img); frmYourFilesHave.setTitle("PewCrypt"); frmYourFilesHave.setType(Type.POPUP); frmYourFilesHave.getContentPane().setBackground(Color.BLACK); frmYourFilesHave.setBounds(100, 100, 1247, 850); frmYourFilesHave.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmYourFilesHave.getContentPane().setLayout(null); txtYourFilesHave = new JTextField(); txtYourFilesHave.setBounds(0, 0, 1215, 45); txtYourFilesHave.setHorizontalAlignment(SwingConstants.CENTER); txtYourFilesHave.setBackground(Color.BLACK); txtYourFilesHave.setForeground(Color.RED); txtYourFilesHave.setEditable(false); txtYourFilesHave.setText("Your Files Have Been Encrypted!"); frmYourFilesHave.getContentPane().add(txtYourFilesHave); txtYourFilesHave.setColumns(10); JTextArea Instructions = new JTextArea(); Instructions.setBounds(0, 242, 1215, 203); Instructions.setEditable(false); Instructions.setFont(new Font("Monospaced", Font.PLAIN, 18)); Instructions.setBackground(Color.BLACK); Instructions.setForeground(Color.RED); Instructions.setText( "Your files have been encrypted using a 256 bit AES key which has been encrypted with a 2048 bit RSA key\r\nIn order to get your files back read the instructions bellow\r\n\r\nInstructions:\r\r\n - Subscribe to Pewdiepie (Hint: Hit the bro fist)\r\r\n - Wait until Pewdiepie reaches 100 million subs at which point a decryption tool will be realseaed\r\r\nIf T-Series beats Pewdiepie THE PRIVATE KEY WILL BE DELETED AND YOU FILES GONE FOREVER!"); frmYourFilesHave.getContentPane().add(Instructions); progressBarPEW.setMaximum(100000000); progressBarPEW.setForeground(new Color(0, 153, 204)); progressBarPEW.setToolTipText("Pewdiepie Sub Progress Bar"); progressBarPEW.setBackground(Color.DARK_GRAY); progressBarPEW.setBounds(0, 85, 1215, 50); frmYourFilesHave.getContentPane().add(progressBarPEW); progressBarT.setMaximum(100000000); progressBarT.setForeground(new Color(204, 0, 0)); progressBarT.setToolTipText("T-Series Sub Progress Bar"); progressBarT.setBackground(Color.DARK_GRAY); progressBarT.setBounds(0, 186, 1215, 50); frmYourFilesHave.getContentPane().add(progressBarT); JButton btnNewButton = new JButton(new ImageIcon(img)); btnNewButton.setBackground(Color.BLACK); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { // open Pewdiepie channel Desktop.getDesktop().browse(new URI("https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw")); } catch (IOException | URISyntaxException e) { e.printStackTrace(); } } }); btnNewButton.setBounds(491, 485, 241, 249); btnNewButton.setBorderPainted(false); btnNewButton.setFocusPainted(false); btnNewButton.setContentAreaFilled(false); frmYourFilesHave.getContentPane().add(btnNewButton); lblPewdiepie.setHorizontalAlignment(SwingConstants.CENTER); lblPewdiepie.setForeground(Color.RED); lblPewdiepie.setBounds(0, 47, 1215, 33); frmYourFilesHave.getContentPane().add(lblPewdiepie); lblT.setHorizontalAlignment(SwingConstants.CENTER); lblT.setForeground(Color.RED); lblT.setBounds(0, 144, 1215, 33); frmYourFilesHave.getContentPane().add(lblT); }
Example 8
Source File: AboutPage.java From xdm with GNU General Public License v2.0 | 4 votes |
public AboutPage(XDMFrame xframe) { super(StringResource.get("TITLE_ABOUT"), getScaledInt(350), xframe); int y = 0; int h = 0; JPanel panel = new JPanel(); panel.setLayout(null); panel.setOpaque(false); y += getScaledInt(10); h = getScaledInt(50); JLabel lblTitle = new JLabel(StringResource.get("FULL_NAME")); lblTitle.setFont(FontResource.getBiggerFont()); lblTitle.setForeground(Color.WHITE); lblTitle.setBounds(getScaledInt(15), y, getScaledInt(350) - getScaledInt(30), h); panel.add(lblTitle); y += h; y += getScaledInt(20); String details = String.format( "Version %s with Java %s on %s\n\nCreated by: Subhra Das Gupta\n\n%s\nCopyright (C) 2020, All rights reserved.", XDMApp.APP_VERSION, (System.getProperty("java.vendor") + " " + System.getProperty("java.version")), System.getProperty("os.name"), "https://github.com/subhra74/xdm"); h = getScaledInt(250); JTextArea lblDetails = new JTextArea(); lblDetails.setOpaque(false); lblDetails.setWrapStyleWord(true); lblDetails.setLineWrap(true); lblDetails.setEditable(false); lblDetails.setForeground(Color.WHITE); lblDetails.setText(details); lblDetails.setFont(FontResource.getBigFont()); lblDetails.setBounds(getScaledInt(15), y, getScaledInt(350) - getScaledInt(30), h); panel.add(lblDetails); y += h; panel.setPreferredSize(new Dimension(getScaledInt(350), y)); panel.setBounds(0, 0, getScaledInt(350), y); jsp.setViewportView(panel); }
Example 9
Source File: BrowserAddonDlg.java From xdm with GNU General Public License v2.0 | 4 votes |
private void initUI() { setUndecorated(true); try { if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) { if (!Config.getInstance().isNoTransparency()) { setOpacity(0.85f); } } } catch (Exception e) { Logger.log(e); } setIconImage(ImageResource.getImage("icon.png")); setSize(getScaledInt(400), getScaledInt(300)); setLocationRelativeTo(null); setAlwaysOnTop(true); getContentPane().setLayout(null); getContentPane().setBackground(ColorResource.getDarkestBgColor()); JPanel titlePanel = new TitlePanel(null, this); titlePanel.setOpaque(false); titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50)); JButton closeBtn = new CustomButton(); closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30)); closeBtn.setBackground(ColorResource.getDarkestBgColor()); closeBtn.setBorderPainted(false); closeBtn.setFocusPainted(false); closeBtn.setName("CLOSE"); closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20)); closeBtn.addActionListener(this); titlePanel.add(closeBtn); JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING")); titleLbl.setFont(FontResource.getBiggerFont()); titleLbl.setForeground(ColorResource.getSelectionColor()); titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30)); titlePanel.add(titleLbl); JLabel lineLbl = new JLabel(); lineLbl.setBackground(ColorResource.getSelectionColor()); lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1); lineLbl.setOpaque(true); add(lineLbl); add(titlePanel); int y = getScaledInt(65); int h = getScaledInt(50); JTextArea lblMonitoringTitle = new JTextArea(); lblMonitoringTitle.setOpaque(false); lblMonitoringTitle.setWrapStyleWord(true); lblMonitoringTitle.setLineWrap(true); lblMonitoringTitle.setEditable(false); lblMonitoringTitle.setForeground(Color.WHITE); lblMonitoringTitle.setText(this.desc); lblMonitoringTitle.setFont(FontResource.getNormalFont()); lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h); add(lblMonitoringTitle); y += h; JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y); btViewMonitoring.setName("COPY"); add(btViewMonitoring); y += btViewMonitoring.getHeight(); }
Example 10
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 11
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 12
Source File: DialogFrame.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 4 votes |
public DialogFrame() { setType(Type.POPUP); setResizable(false); setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); this.setTitle("Approving question"); this.setPreferredSize(new Dimension(400, 190)); this.setAlwaysOnTop(isAlwaysOnTopSupported()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75); this.setIconImage(Toolkit.getDefaultToolkit(). getImage(getClass().getResource(LOGOPATH))); final JPanel panel = new JPanel(); panel.setAutoscrolls(true); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); btnYes = new JButton("YES"); btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null)); btnYes.setBounds(291, 129, 91, 29); panel.add(btnYes); btnNo = new JButton("NO"); btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null)); btnNo.setBounds(199, 129, 91, 29); panel.add(btnNo); lblIcon = new JLabel(""); lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png"))); lblIcon.setBounds(14, 40, 69, 70); panel.add(lblIcon); textArea = new JTextArea(); textArea.setDisabledTextColor(new Color(153, 204, 255)); textArea.setBounds(95, 32, 287, 85); textArea.setBackground(UIManager.getColor("ComboBox.background")); textArea.setBorder(null); textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); textArea.setEditable(false); textArea.setFont(new Font("Monospaced", Font.PLAIN, 14)); textArea.setLineWrap(true); panel.add(textArea); this.pack(); }
Example 13
Source File: SplashScreen.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public static JPanel createSplashPanel() { final ImageIcon picture = IconLoader.getInstance().getAboutDialogPicture(); // Create the image panel final JPanel imagePanel = new JPanel( new BorderLayout() ); imagePanel.setUI( new BackgroundUI( picture ) ); imagePanel.setBorder( BorderFactory.createLineBorder( Color.DARK_GRAY ) ); // Overlay the version final JLabel versionLabel = new JLabel(); final String buildString = ReportDesignerInfo.getInstance().getVersion(); if ( buildString == null ) { versionLabel.setText( Messages.getString( "SplashScreen.DevelopmentVersion" ) ); } else { versionLabel.setText( buildString ); } versionLabel.setText( Messages.getString( "SplashScreen.Version", versionLabel.getText() ) ); versionLabel.setFont( new Font( Font.SANS_SERIF, Font.BOLD, 14 ) ); versionLabel.setOpaque( false ); versionLabel.setBackground( TRANSPARENT ); versionLabel.setForeground( DARK_GREY ); versionLabel.setBorder( BORDER ); versionLabel.setBounds( XLOC, YLOC, TEXT_WIDTH, versionLabel.getPreferredSize().height ); // Overlay the license final String year = new SimpleDateFormat( "yyyy" ).format( new Date() ); final JTextArea copyrightArea = new JTextArea( Messages.getString( "SplashScreen.Copyright", year ) ); copyrightArea.setEditable( false ); copyrightArea.setBounds( XLOC, YLOC + 20, TEXT_WIDTH, LICENSE_HEIGHT ); copyrightArea.setOpaque( false ); copyrightArea.setLineWrap( true ); copyrightArea.setWrapStyleWord( true ); copyrightArea.setFont( COPYRIGHT_FONT ); copyrightArea.setEnabled( false ); copyrightArea.setBackground( TRANSPARENT ); copyrightArea.setForeground( DARK_GREY ); copyrightArea.setBorder( BORDER ); copyrightArea.setDisabledTextColor( copyrightArea.getForeground() ); // Overlay the copyright final JTextArea licenseArea = new JTextArea( Messages.getString( "SplashScreen.License" ) ); licenseArea.setEditable( false ); licenseArea.setBounds( XLOC, YLOC + 14 + LICENSE_HEIGHT, TEXT_WIDTH, COPYRIGHT_HEIGHT ); licenseArea.setOpaque( false ); licenseArea.setLineWrap( true ); licenseArea.setWrapStyleWord( true ); licenseArea.setFont( LICENSE_FONT ); licenseArea.setEnabled( false ); licenseArea.setBackground( TRANSPARENT ); licenseArea.setBorder( BORDER ); licenseArea.setDisabledTextColor( copyrightArea.getForeground() ); // Add all the overlays final JPanel imagePanelOverlay = new JPanel( null ); imagePanelOverlay.setOpaque( false ); imagePanelOverlay.add( versionLabel ); imagePanelOverlay.add( copyrightArea ); imagePanelOverlay.add( licenseArea ); imagePanelOverlay.setBackground( TRANSPARENT ); imagePanel.add( imagePanelOverlay ); imagePanel.setPreferredSize( new Dimension( picture.getIconWidth(), picture.getIconHeight() ) ); return imagePanel; }