Java Code Examples for javax.swing.JTextArea.setVisible()

The following are Jave code examples for showing how to use setVisible() of the javax.swing.JTextArea class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: BrainControl   File: MarioError.java   Source Code and License Vote up 4 votes
public MarioError(String errorMessage){
	super("ERROR");
	//applicable for multi monitor workstations
	GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
	screenWidth = gd.getDisplayMode().getWidth();
	screenHight = gd.getDisplayMode().getHeight(); 

	this.setLocation((int)((screenWidth - frameWidth)*0.5), (int)(screenHight*0.25));
	this.setSize(frameWidth , (int)(screenHight*0.5)); 
	this.getContentPane().setLayout(new GridBagLayout());
	this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	
	titleLabel = new JLabel();
	titleLabel.setText("Unfortunately an Error occured");
	titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
	titleLabel.setFont(new Font(titleLabel.getFont().getFontName(), Font.BOLD, 32));
	titleLabel.setForeground(Color.RED);
	titleLabel.setVisible(true);
	LayoutHelper.putGrid(this, titleLabel, 0, 0, 2,1, 1.0, 1.0);
	
	
	errorText = new JTextArea();
	errorText.setText(errorMessage);
	errorText.setWrapStyleWord(true);
    errorText.setLineWrap(true);
    errorText.setEditable(false);
	errorText.setFont(new Font(errorText.getFont().getFontName(), Font.BOLD, 20));
	errorText.setVisible(true);
	

	errorScrollPane = new JScrollPane(errorText);
	errorText.setCaretPosition(0);
	LayoutHelper.putGrid(this, errorScrollPane, 0, 1, 2,1, 1.0, 1.0);
	
	helpButton = new JButton("HELP");
	helpButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			if (Desktop.isDesktopSupported()) {
			    try {
			        File myFile = new File("D:/Data/Desktop/Mario SoSe15 Einf´┐Żhrung/MarioHelp.pdf");
			        Desktop.getDesktop().open(myFile);
			    } catch (IOException ex) {
			        new MarioError("Could not find help file");
			    }
			}
		}
	});
	LayoutHelper.putGrid(this, helpButton, 0, 2, 2,1, 1.0, 0.2);	
	this.setVisible(true);
}