Java Code Examples for javax.swing.JTextArea#setLineWrap()

The following examples show how to use javax.swing.JTextArea#setLineWrap() . 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: JXMLViewer.java    From freeinternals with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 *
 * @param xml XML data to be displayed
 */
public JXMLViewer(final InputStream xml) {
    this.tabbedPane = new JTabbedPane();
    if (xml instanceof PosDataInputStream) {
        byte[] buf = ((PosDataInputStream) xml).getBuf();
        StringBuilder sb = new StringBuilder(buf.length + 1);
        for (byte b : buf) {
            sb.append((char) b);
        }

        JTextArea textPlainText = new JTextArea(sb.toString());
        textPlainText.setLineWrap(true);
        textPlainText.setEditable(false);
        tabbedPane.addTab("XML Plain Text", new JScrollPane(textPlainText));
    }

    this.setLayout(new BorderLayout());
    this.add(this.tabbedPane, BorderLayout.CENTER);
}
 
Example 2
Source File: MetalworksDocumentFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 3
Source File: GuiUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a text component to be used as a multi-line, automatically
 * wrapping label.
 * <p>
 * <strong>Restriction:</strong><br>
 * The component may have its preferred size very wide.
 *
 * @param  text  text of the label
 * @param  color  desired color of the label,
 *                or {@code null} if the default color should be used
 * @return  created multi-line text component
 */
public static JTextComponent createMultilineLabel(String text, Color color) {
    JTextArea textArea = new JTextArea(text);
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setEnabled(false);
    textArea.setOpaque(false);
    textArea.setColumns(25);
    textArea.setDisabledTextColor((color != null)
                                  ? color
                                  : new JLabel().getForeground());
    
    return textArea;
}
 
Example 4
Source File: UiUtils.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
private static JScrollPane getScrollableMessage(String msg) {
	JTextArea textArea = new JTextArea(msg);
	textArea.setLineWrap(true);
	textArea.setWrapStyleWord(true);
	textArea.setEditable(false);
	textArea.setMargin(new Insets(5, 5, 5, 5));
	textArea.setFont(new JTextField().getFont()); // dirty fix to use better font
	JScrollPane scrollPane = new JScrollPane();
	scrollPane.setPreferredSize(new Dimension(700, 150));
	scrollPane.getViewport().setView(textArea);
	return scrollPane;
}
 
Example 5
Source File: ExtendedErrorDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creates a Panel for the error details and attaches the error message to it, but doesn't add
 * the Panel to the dialog.
 *
 * @param errorMessage
 * @return
 */
private JScrollPane createDetailPanel(String errorMessage) {

	JTextArea textArea = new JTextArea(errorMessage);
	textArea.setLineWrap(true);
	textArea.setEditable(false);
	JScrollPane detailPane = new ExtendedJScrollPane(textArea);
	detailPane.setPreferredSize(new Dimension(getWidth(), 200));
	return detailPane;
}
 
Example 6
Source File: PrintLatinCJKTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void showFrame() {
     JFrame f = new JFrame();
     JTextArea jta = new JTextArea(info, 4, 30);
     jta.setLineWrap(true);
     jta.setWrapStyleWord(true);
     f.add("Center", jta);
     JButton b = new JButton("Print");
     b.addActionListener(testInstance);
     f.add("South", b);
     f.pack();
     f.setVisible(true);
}
 
Example 7
Source File: OperationPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JComponent getTitleComponent (String msg) {
    JTextArea area = new JTextArea (msg);
    area.setWrapStyleWord (true);
    area.setLineWrap (true);
    area.setEditable (false);
    area.setOpaque (false);
    area.setBorder(BorderFactory.createEmptyBorder());
    area.setBackground(new Color(0, 0, 0, 0));
    area.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    return area;
}
 
Example 8
Source File: NoteEditor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link Note} editor.
 *
 * @param note The {@link Note} to edit.
 */
public NoteEditor(Note note) {
    super(note);
    JPanel content   = new JPanel(new ColumnLayout(2, RowDistribution.GIVE_EXCESS_TO_LAST));
    JLabel iconLabel = new JLabel(note.getIcon(true));
    JPanel right     = new JPanel(new ColumnLayout(1, RowDistribution.GIVE_EXCESS_TO_LAST));
    content.add(iconLabel);
    content.add(right);

    mReferenceField = new JTextField(Text.makeFiller(6, 'M'));
    UIUtilities.setToPreferredSizeOnly(mReferenceField);
    mReferenceField.setText(note.getReference());
    mReferenceField.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("A reference to the book and page this note applies to (e.g. B22 would refer to \"Basic Set\", page 22)")));
    mReferenceField.setEnabled(mIsEditable);
    JPanel wrapper = new JPanel(new ColumnLayout(4));
    wrapper.add(new LinkedLabel(I18n.Text("Note Content:")));
    wrapper.add(new JPanel());
    wrapper.add(new LinkedLabel(I18n.Text("Page Reference"), mReferenceField));
    wrapper.add(mReferenceField);
    right.add(wrapper);

    mEditor = new JTextArea(note.getDescription());
    mEditor.setLineWrap(true);
    mEditor.setWrapStyleWord(true);
    mEditor.setEnabled(mIsEditable);
    JScrollPane scroller = new JScrollPane(mEditor, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scroller.setMinimumSize(new Dimension(400, 300));
    iconLabel.setVerticalAlignment(SwingConstants.TOP);
    iconLabel.setAlignmentY(-1.0f);
    right.add(scroller);

    add(content);
}
 
Example 9
Source File: Interpolator.java    From GIFKR with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initializeComponents() {

		instructionArea = new JTextArea(getInstructions());
		instructionArea.setLineWrap(true);
		instructionArea.setWrapStyleWord(true);
		instructionArea.setEditable(false);
		instructionArea.setOpaque(false);
		
		animationButton = new JButton() {
			private static final long serialVersionUID = 225462629234945413L;
			@Override 
			public void paint(Graphics ga) {
				Graphics2D g = (Graphics2D) ga;

				g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
				g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

				super.paint(ga);


				double xs = .9, ys = .75;

				g.translate(animationButton.getWidth()*((1-xs)/2), animationButton.getHeight()*((1-ys)/2));
				g.scale(xs, ys);
				paintButton(g, animationButton.getWidth(), animationButton.getHeight());

			}		
			@Override
			public Dimension getPreferredSize() {
				return new Dimension(super.getPreferredSize().width, 50);
			}
		};
	}
 
Example 10
Source File: MetalworksDocumentFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public MetalworksDocumentFrame() {
    super("", true, true, true, true);
    openFrameCount++;
    setTitle("Untitled Message " + openFrameCount);

    JPanel top = new JPanel();
    top.setBorder(new EmptyBorder(10, 10, 10, 10));
    top.setLayout(new BorderLayout());
    top.add(buildAddressPanel(), BorderLayout.NORTH);

    JTextArea content = new JTextArea(15, 30);
    content.setBorder(new EmptyBorder(0, 5, 0, 5));
    content.setLineWrap(true);



    JScrollPane textScroller = new JScrollPane(content,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    top.add(textScroller, BorderLayout.CENTER);


    setContentPane(top);
    pack();
    setLocation(offset * openFrameCount, offset * openFrameCount);

}
 
Example 11
Source File: DeckDescriptionViewer.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
public DeckDescriptionViewer() {

        setOpaque(false);

        final TitleBar titleBar = new TitleBar(MText.get(_S1));

        textArea = new JTextArea();
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        textArea.setBackground(FontsAndBorders.TEXTAREA_TRANSPARENT_COLOR_HACK);

        scrollPane = new JScrollPane(textArea);
        scrollPane.getVerticalScrollBar().setUnitIncrement(8);
        scrollPane.setBorder(null);
        scrollPane.getViewport().setOpaque(false);
        scrollPane.setMinimumSize(new Dimension(0, 0));
        scrollPane.setPreferredSize(new Dimension(getWidth(), 0));

        setMinimumSize(new Dimension(0, titleBar.getMinimumSize().height));

        final MigLayout mig = new MigLayout();
        mig.setLayoutConstraints("flowy, insets 0, gap 0");
        mig.setColumnConstraints("[fill, grow]");
        mig.setRowConstraints("[][fill, grow]");
        setLayout(mig);
        add(titleBar);
        add(scrollPane);

    }
 
Example 12
Source File: AboutDialog.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a panel showing the licence.
 *
 * @return a panel.
 */
private JPanel createLicencePanel() {

    final JPanel licencePanel = new JPanel(new BorderLayout());
    final JTextArea area = new JTextArea(this.licence);
    area.setLineWrap(true);
    area.setWrapStyleWord(true);
    area.setCaretPosition(0);
    area.setEditable(false);
    licencePanel.add(new JScrollPane(area));
    return licencePanel;

}
 
Example 13
Source File: FlexibleFileWriterGui.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
private void init() {
    setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());

    add(JMeterPluginsUtils.addHelpLinkToPanel(makeTitlePanel(), WIKIPAGE), BorderLayout.NORTH);

    JPanel mainPanel = new JPanel(new GridBagLayout());

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.anchor = GridBagConstraints.FIRST_LINE_END;

    GridBagConstraints editConstraints = new GridBagConstraints();
    editConstraints.anchor = GridBagConstraints.FIRST_LINE_START;
    editConstraints.weightx = 1.0;
    editConstraints.fill = GridBagConstraints.HORIZONTAL;

    addToPanel(mainPanel, labelConstraints, 0, 1, new JLabel("Filename: ", JLabel.RIGHT));
    addToPanel(mainPanel, editConstraints, 1, 1, filename = new JTextField(20));
    JButton browseButton = new JButton("Browse...");
    addToPanel(mainPanel, labelConstraints, 2, 1, browseButton);
    GuiBuilderHelper.strechItemToComponent(filename, browseButton);
    browseButton.addActionListener(new BrowseAction(filename));

    addToPanel(mainPanel, labelConstraints, 0, 2, new JLabel("Overwrite existing file: ", JLabel.RIGHT));
    addToPanel(mainPanel, editConstraints, 1, 2, overwrite = new JCheckBox());

    addToPanel(mainPanel, labelConstraints, 0, 3, new JLabel("Write File Header: ", JLabel.RIGHT));
    header = new JTextArea();
    header.setLineWrap(true);
    addToPanel(mainPanel, editConstraints, 1, 3, GuiBuilderHelper.getTextAreaScrollPaneContainer(header, 3));

    editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
    labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
    addToPanel(mainPanel, labelConstraints, 0, 4, new JLabel("Record each sample as: ", JLabel.RIGHT));
    addToPanel(mainPanel, editConstraints, 1, 4, columns = new JTextField(20));

    editConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
    labelConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
    addToPanel(mainPanel, labelConstraints, 0, 5, new JLabel("Write File Footer: ", JLabel.RIGHT));
    footer = new JTextArea();
    footer.setLineWrap(true);
    addToPanel(mainPanel, editConstraints, 1, 5, GuiBuilderHelper.getTextAreaScrollPaneContainer(footer, 3));

    JPanel container = new JPanel(new BorderLayout());
    container.add(mainPanel, BorderLayout.NORTH);
    add(container, BorderLayout.CENTER);

    add(createHelperPanel(), BorderLayout.SOUTH);
}
 
Example 14
Source File: RouterClientTest.java    From jRUDP with MIT License 4 votes vote down vote up
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 15
Source File: InputDialog.java    From Spark with Apache License 2.0 4 votes vote down vote up
/**
  * Prompt and return input.
  *
  * @param title       the title of the dialog.
  * @param description the dialog description.
  * @param icon        the icon to use.
  * @param parent      the parent to use.
  * @return the user input.
  */
 public String getInput(String title, String description, Icon icon, Component parent) {
     textArea = new JTextArea();
     textArea.setLineWrap(true);

     TitlePanel titlePanel = new TitlePanel(title, description, icon, true);

     // Construct main panel w/ layout.
     final JPanel mainPanel = new JPanel();
     mainPanel.setLayout(new BorderLayout());
     mainPanel.add(titlePanel, BorderLayout.NORTH);

     // The user should only be able to close this dialog.
     final Object[] options = {Res.getString("ok"), Res.getString("cancel")};
     optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE,
         JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);

     mainPanel.add(optionPane, BorderLayout.CENTER);

     // Lets make sure that the dialog is modal. Cannot risk people
     // losing this dialog.
     JOptionPane p = new JOptionPane();
     dialog = p.createDialog(parent, title);
     dialog.setModal(true);
     dialog.pack();
     dialog.setSize(width, height);
     dialog.setContentPane(mainPanel);
     dialog.setLocationRelativeTo(parent);
     optionPane.addPropertyChangeListener(this);

     // Add Key Listener to Send Field
     textArea.addKeyListener(new KeyAdapter() {
         @Override
public void keyPressed(KeyEvent e) {
             if (e.getKeyChar() == KeyEvent.VK_TAB) {
                 optionPane.requestFocus();
             }
             else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
                 dialog.dispose();
             }
         }
     });

     textArea.requestFocus();
     textArea.setWrapStyleWord(true);


     dialog.setVisible(true);
     return stringValue;
 }
 
Example 16
Source File: FeedbackDialog.java    From chipster with MIT License 4 votes vote down vote up
public FeedbackDialog(SwingClientApplication application, String errorMessage, boolean sendSessionByDefault) {
    super(application.getMainFrame(), true);

    this.application = application;
    this.setTitle("Contact support");
    this.errorMessage = errorMessage;
    
    // Layout
    this.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.gridx = 0; 
    c.gridy = 0;
    
    // Text are for entering details
    c.insets.set(10,10,5,10);
    c.gridy++;
    this.add(new JLabel("Message"), c);
    detailArea = new JTextArea();
    detailArea.setLineWrap(true);
    detailArea.setWrapStyleWord(true);
    detailArea.setPreferredSize(new Dimension(300, 150));
    c.insets.set(0, 10, 10, 10);  
    c.gridy++;
    this.add(detailArea, c);
    
    // Email
    c.insets.set(10,10,5,10);
    c.gridy++;
    this.add(new JLabel("Your email"), c);
    emailField = new JTextField();
    emailField.setPreferredSize(new Dimension(300, 20));
    c.insets.set(0, 10, 10, 10);  
    c.gridy++;
    this.add(emailField, c);
    
    // Checkbox for attaching user data
    c.insets.set(10,10,5,10);
    c.gridy++;
    attachSessionBox = new JCheckBox("Attach data and workflow information");
    attachSessionBox.setSelected(sendSessionByDefault);
    this.add(attachSessionBox, c);
    
    // Checkbox for client logs
    c.insets.set(10,10,5,10);
    c.gridy++;
    attachLogsBox = new JCheckBox("Attach log files");
    attachLogsBox.setSelected(true);
    this.add(attachLogsBox, c);
    
    // OK button
    okButton = new JButton("OK");
    okButton.setPreferredSize(BUTTON_SIZE);
    okButton.addActionListener(this);
    
    // Cancel button
    cancelButton = new JButton("Cancel");
    cancelButton.setPreferredSize(BUTTON_SIZE);
    cancelButton.addActionListener(this);
    
    // Buttons pannel
    JPanel buttonsPanel = new JPanel();
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(buttonsPanel, c);
}
 
Example 17
Source File: DataDetails.java    From chipster with MIT License 4 votes vote down vote up
/**
 * @param panel2 
 * @return A String containing descriptions of the chosen dataset's
 * 		   attributes - that is, name, date, and details about the
 * 		   operation (including parameters) that produced it.
 */
private JPanel createParameterTable(JPanel panel) {

	final int TOOL_WIDTH = 250;
	
		
	OperationRecord operationRecord = datas.get(0).getOperationRecord();			
	if (operationRecord != null) {

		Collection<ParameterRecord> params = operationRecord.getParameters();

		if (params != null) {
			for (ParameterRecord parameterRecord : params) {

				// find out default value and human readable value
				OperationDefinition tool = application.getOperationDefinition(operationRecord.getNameID().getID());
				
				String defaultValue = null;
				String valueString = null;
									
				if (tool != null) {
					defaultValue = tool.getParameterDefaultValue(parameterRecord);
					valueString = tool.getHumanReadableParameterValue(parameterRecord);
					
				} else {						
					valueString = parameterRecord.getValue();
				}

				JTextArea name = new JTextArea(parameterRecord.getNameID().getDisplayName());					
				JTextArea value =  new JTextArea(valueString);
				
				name.setLineWrap(true);
				value.setLineWrap(true);
				
				name.setWrapStyleWord(true);
				value.setWrapStyleWord(true);
				
				name.setEditable(false);
				value.setEditable(false);

				// fade out default values
				if (defaultValue != null && defaultValue.equals(parameterRecord.getValue())) {
					value.setForeground(Color.gray);
				}
				
				panel.add(name, "split 2, gapx " + INDENTION + ", width " + TOOL_WIDTH);
				panel.add(value, "growx, pushx, wrap");
			}
		}
	}

	return panel;
}
 
Example 18
Source File: DownloadWindow.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
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 19
Source File: CheckIndexDialogFactory.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
private JPanel logs() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(false);

  JPanel header = new JPanel();
  header.setOpaque(false);
  header.setLayout(new BoxLayout(header, BoxLayout.PAGE_AXIS));

  JPanel repair = new JPanel(new FlowLayout(FlowLayout.LEADING));
  repair.setOpaque(false);
  repair.add(repairBtn);

  JTextArea warnArea = new JTextArea(MessageUtils.getLocalizedMessage("checkidx.label.warn"), 3, 30);
  warnArea.setLineWrap(true);
  warnArea.setEditable(false);
  warnArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

  repair.add(warnArea);
  header.add(repair);

  JPanel note = new JPanel(new FlowLayout(FlowLayout.LEADING));
  note.setOpaque(false);
  note.add(new JLabel(MessageUtils.getLocalizedMessage("checkidx.label.note")));
  header.add(note);

  JPanel status = new JPanel(new FlowLayout(FlowLayout.LEADING));
  status.setOpaque(false);
  status.add(new JLabel(MessageUtils.getLocalizedMessage("label.status")));
  statusLbl.setText("Idle");
  status.add(statusLbl);
  indicatorLbl.setVisible(false);
  status.add(indicatorLbl);
  header.add(status);

  panel.add(header, BorderLayout.PAGE_START);

  logArea.setText("");
  panel.add(new JScrollPane(logArea), BorderLayout.CENTER);

  return panel;
}
 
Example 20
Source File: CFirstStartDialog.java    From binnavi with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new dialog object.
 * 
 * @param parent Parent window of the dialog.
 */
private CFirstStartDialog(final Window parent) {
  super(parent, "Welcome to BinNavi", ModalityType.APPLICATION_MODAL);

  setLayout(new BorderLayout());

  setSize(450, 417);

  setResizable(false);

  GuiHelper.centerChildToParent(parent, this, true);

  final JPanel centerPanel = new JPanel(new BorderLayout());

  final ImagePanel panel =
      new ImagePanel(new ImageIcon(CMain.class.getResource("data/startup_logo.png")).getImage());

  centerPanel.add(panel, BorderLayout.WEST);

  final JTextArea area =
      new JTextArea("Welcome to BinNavi" + "\n\n"
          + "This is the first time you are using BinNavi on this computer. "
          + "If you have never used BinNavi before, you should familiarize "
          + "yourself with the basic concepts of BinNavi." + "\n\n"
          + "To learn about these concepts you can either read the manual or use "
          + "one of the interactive tutorials you can find in the Help menu of the "
          + "BinNavi main window." + "\n\n"
          + "If you just want to get started, you should configure the database "
          + "you can find on the left side of the main window. Once you have "
          + "successfully established a connection to the database you want to use, "
          + "you can start to import disassembly data from an external data source like IDA Pro.");

  area.setBorder(new EmptyBorder(5, 5, 5, 5));
  area.setWrapStyleWord(true);
  area.setLineWrap(true);

  area.setEditable(false);

  final JPanel innerPanel = new JPanel(new BorderLayout());

  innerPanel.setBorder(new LineBorder(Color.BLACK, 1));
  innerPanel.add(area);

  centerPanel.add(innerPanel);

  add(centerPanel);

  final JPanel bottomPanel = new JPanel(new BorderLayout());

  bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

  final JButton closeButton = new JButton(new CloseAction());

  bottomPanel.add(closeButton, BorderLayout.EAST);

  add(bottomPanel, BorderLayout.SOUTH);

  getRootPane().setDefaultButton(closeButton);

  new CDialogEscaper(this);
}