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

The following examples show how to use javax.swing.JTextArea#setFont() . 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: CounterRequestDetailPanel.java    From javamelody with Apache License 2.0 7 votes vote down vote up
private JPanel createSqlRequestExplainPlanPanel(String sqlRequestExplainPlan) {
	final JTextArea textArea = new JTextArea();
	textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, textArea.getFont().getSize() - 1));
	textArea.setEditable(false);
	textArea.setCaretPosition(0);
	// background nécessaire avec la plupart des look and feels dont Nimbus,
	// sinon il reste blanc malgré editable false
	textArea.setBackground(Color.decode("#E6E6E6"));
	textArea.setText(sqlRequestExplainPlan);
	final JPanel panel = new JPanel(new BorderLayout());
	panel.setOpaque(false);
	final JLabel label = new JLabel(getString("Plan_d_execution"));
	label.setFont(label.getFont().deriveFont(Font.BOLD));
	panel.add(label, BorderLayout.NORTH);
	final JScrollPane scrollPane = new JScrollPane(textArea);
	panel.add(scrollPane, BorderLayout.CENTER);
	return panel;
}
 
Example 2
Source File: TextHistoryPane.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * constructor
 * 
 * @param nlines number of lines of text to keep history of
 * @param removeIncr remove this number of lines at a time
 * @param popupOK enable popup menu
 * @param ptSize font point size
 */
public TextHistoryPane(boolean editable, int nlines, int removeIncr, boolean popupOK, boolean lineWrap, int ptSize) {
  super(new BorderLayout());
  this.nlines = nlines - 1;
  this.removeIncr = Math.min(nlines - 1, removeIncr - 1); // cant be bigger than nlines

  ta = new JTextArea();
  ta.setLineWrap(lineWrap);
  ta.setEditable(editable);
  fontu = FontUtil.getMonoFont(ptSize);
  ta.setFont(fontu.getFont());

  if (popupOK)
    ta.addMouseListener(new MyPopupMenu());

  // JScrollPane sp = new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
  // JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  JScrollPane sp = new JScrollPane(ta); // , JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        // JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  add(sp, BorderLayout.CENTER);

  javax.swing.filechooser.FileFilter[] filters = new javax.swing.filechooser.FileFilter[2];
  filters[0] = new FileManager.HDF5ExtFilter();
  filters[1] = new FileManager.NetcdfExtFilter();
  fileChooser = new FileManager(null, null, null, null);
}
 
Example 3
Source File: MarkdownTextAreaWithPreview.java    From meka with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initializes the widgets.
 */
@Override
protected void initGUI() {
	super.initGUI();

	setLayout(new BorderLayout());

	m_TabbedPane = new JTabbedPane();
	add(m_TabbedPane, BorderLayout.CENTER);

	m_TextCode = new JTextArea();
	m_TextCode.setFont(GUIHelper.getMonospacedFont());
	m_TabbedPane.addTab("Write", new BaseScrollPane(m_TextCode));

	m_PanePreview = new JEditorPane();
	m_PanePreview.setEditable(false);
	m_PanePreview.setContentType("text/html");
	m_TabbedPane.addTab("Preview", new BaseScrollPane(m_PanePreview));

	m_TabbedPane.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			update();
		}
	});
}
 
Example 4
Source File: Calculator.java    From testing-cin with MIT License 6 votes vote down vote up
public Calculator() {
    super("Calculator");
 
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel numberPanel = buildNumberPanel();
    JPanel operatorPanel = buildOperatorPanel();
    JPanel clearPanel = buildClearPanel();
    lcdDisplay = new JTextArea();
    lcdDisplay.setName("lcd");
    lcdDisplay.setFont(new Font("Dialog", Font.BOLD, 18));
    mainPanel.add(clearPanel, BorderLayout.SOUTH);
    mainPanel.add(numberPanel, BorderLayout.CENTER);
    mainPanel.add(operatorPanel, BorderLayout.EAST);
    mainPanel.add(lcdDisplay, BorderLayout.NORTH);
 
    errorDisplay = new JLabel();
    errorDisplay.setName("error");
    errorDisplay.setFont(new Font("Dialog", Font.BOLD, 12));
 
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(errorDisplay, BorderLayout.SOUTH);
 
    pack();
    resetState();
}
 
Example 5
Source File: SimpleApp.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
private final void initializeTextArea(String[] args) {
 		JTextArea textArea = new JTextArea();
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
textArea.setEditable(false);

JScrollPane scrollPane = new JScrollPane();
   scrollPane.setViewportView(textArea);
   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   getContentPane().add(scrollPane);

textArea.setText(getMainProperties(args));
textArea.append(getAllProperties());
textArea.append(getEnvironmentVariables());
 	}
 
Example 6
Source File: UserMessageDialog.java    From gepard with MIT License 5 votes vote down vote up
private void setupGUI() {
	setLayout(new GridBagLayout());
	
	GridBagConstraints c = new GridBagConstraints();
	
	c.insets = new Insets(5,5,5,5);
	
	c.gridx = 0; c.gridy = 0;
	c.weightx = 1; c.weighty = 1000;
	c.fill = GridBagConstraints.BOTH;  
	
	txtMessage = new JTextArea();
	JScrollPane scrolling = new JScrollPane(txtMessage);
	add(scrolling, c);
	
	c.gridy++;
	c.weighty = 1;
	c.fill = GridBagConstraints.VERTICAL;
	c.anchor = GridBagConstraints.EAST;
	JButton btnQuit;
	add(btnQuit = new JButton("Close"),c);
	
	// create border
	//txtMessage.setBorder(BorderFactory.createEtchedBorder() );
	// scrolling
	scrolling.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	scrolling.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
	// set font
	txtMessage.setFont(new Font("Courier", Font.PLAIN, 11));
	// additional flags
	txtMessage.setEditable(false);
	txtMessage.setLineWrap(true);
	txtMessage.setWrapStyleWord(true);
	
	// event handler
	btnQuit.addActionListener(this);
	
}
 
Example 7
Source File: TableCellLongTextRenderer.java    From WhiteRabbit with Apache License 2.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
	final JTextArea jtext = new JTextArea();
	jtext.setText((String)value);
	jtext.setWrapStyleWord(true);                    
	jtext.setLineWrap(true);   
	jtext.setFont(table.getFont());
	jtext.setSize(table.getColumn(table.getColumnName(column)).getWidth(), (int)jtext.getPreferredSize().getHeight());
	
	jtext.setMargin(new Insets(10,5,10,5));
     	
	return jtext;
}
 
Example 8
Source File: SettingsPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JTextArea createTextArea(String name, Font font) {
	JTextArea textArea = new JTextArea();
	textArea.setOpaque(false);
	textArea.setWrapStyleWord(true);
	textArea.setLineWrap(true);
	textArea.setEditable(false);
	textArea.setForeground(Color.WHITE);
	textArea.setText(StringResource.get(name));
	textArea.setFont(font);
	return textArea;
}
 
Example 9
Source File: Oculus.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
public static void showDialog(String title, String message, int style) {
   JTextArea area = new JTextArea(message);
   area.setBackground(UIManager.getColor("OptionPane.background"));
   area.setEditable(false);
   JComponent content = area;

   // If the message is too long then wrap it in
   // a scrollable text area and make the font
   // fixed width.
   if (message.length() >= 128) {
      area.setFont(new Font("monospaced", Font.PLAIN, 12));

      JScrollPane jp = new JScrollPane(area);
      jp.getViewport().add(area);

      //area.setColumns(80);
      area.setLineWrap(true);

      jp.setPreferredSize(new Dimension(800,600));
      content = jp;
   }

   // Make the dialog resizable:
   // https://blogs.oracle.com/scblog/entry/tip_making_joptionpane_dialog_resizable
   final JComponent pane = content;
   pane.addHierarchyListener(new HierarchyListener() {
      public void hierarchyChanged(HierarchyEvent e) {
         Window window = SwingUtilities.getWindowAncestor(pane);
         if (window instanceof Dialog) {
            Dialog dialog = (Dialog)window;
            if (!dialog.isResizable()) {
               dialog.setResizable(true);
            }
         }
      }
   });

   JOptionPane.showMessageDialog(MAIN, pane, title, style);
}
 
Example 10
Source File: GltfViewerPanel.java    From JglTF with MIT License 5 votes vote down vote up
/**
 * Create the viewer component using the given constructor. 
 * 
 * @param constructor The constructor.
 */
private void createViewer(
    Supplier<? extends GltfViewer<? extends Component>> constructor)
{
    disposeGltfViewer();
    animationsRunningButton.setSelected(false);
    animationsRunningButton.setEnabled(false);
    viewerComponentContainer.removeAll();
    try
    {
        gltfViewer = constructor.get();
        gltfViewer.setAnimationsRunning(false);
        gltfViewer.addGltfModel(gltfModel);
        
        Component renderComponent = gltfViewer.getRenderComponent();
        externalCamera.setComponent(renderComponent);
        
        gltfViewer.setExternalCamera(externalCamera);
        viewerComponentContainer.add(renderComponent);
        animationsRunningButton.setEnabled(true);
        
        updateCameraModelsComboBox();
    }
    catch (Throwable t)
    {
        // The constructor may throw everything. Particularly, when 
        // the native library can not be found, it will throw an
        // UnsatisfiedLinkError (oh how we love it...). 
        // All this is handled here, pragmatically...
        StringWriter stringWriter = new StringWriter();
        t.printStackTrace(new PrintWriter(stringWriter));
        JTextArea textArea = new JTextArea();
        textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
        textArea.setText(
            "Error while creating viewer:\n" + stringWriter.toString());
        viewerComponentContainer.add(new JScrollPane(textArea));
    }
    revalidate();
    repaint();
}
 
Example 11
Source File: UIRes.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public static void addStyle(JTextArea textArea, String labelName, boolean isBorder) {
	Border border = null;
	if (isBorder) {
		Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
		TitledBorder titled = BorderFactory.createTitledBorder(line, labelName);
		titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13));
		titled.setTitleColor(fontColorTitle);
	}
	textArea.setBorder(border);
	textArea.setForeground(fontColor);
	textArea.setFont(GraphicsUtils.getFont("Monospaced", 0, 13));
}
 
Example 12
Source File: StockpileShoppingListDialog.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
StockpileShoppingListDialog(final Program program) {
	super(program,  TabsStockpile.get().shoppingList(), Images.TOOL_STOCKPILE.getImage());

	this.getDialog().setResizable(true);
	
	ListenerClass listener = new ListenerClass();

	JButton jCopyToClipboard = new JButton(TabsStockpile.get().clipboardStockpile(), Images.EDIT_COPY.getIcon());
	jCopyToClipboard.setActionCommand(StockpileShoppingListAction.CLIPBOARD_STOCKPILE.name());
	jCopyToClipboard.addActionListener(listener);

	String[] formats = {TabsStockpile.get().shoppingList(), TabsStockpile.get().eveMultibuy()};
	jEveMultiBuy = new JComboBox<String>(formats);
	IconListCellRendererRenderer renderer = new IconListCellRendererRenderer();
	renderer.add(TabsStockpile.get().shoppingList(), Images.STOCKPILE_SHOPPING_LIST.getIcon());
	renderer.add(TabsStockpile.get().eveMultibuy(), Images.MISC_EVE.getIcon());
	jEveMultiBuy.setRenderer(renderer);
	jEveMultiBuy.setActionCommand(StockpileShoppingListAction.FORMAT_CHANGED.name());
	jEveMultiBuy.addActionListener(listener);

	JLabel jFullLabel = new JLabel(TabsStockpile.get().percentFull());
	JLabel jFullPercentLabel = new JLabel(TabsStockpile.get().percent());

	jPercentFull = new JIntegerField("");
	jPercentFull.addCaretListener(listener);

	JLabel jIgnoreLabel = new JLabel(TabsStockpile.get().percentIgnore());
	JLabel jIgnorePercentLabel = new JLabel(TabsStockpile.get().percent());

	jPercentIgnore = new JIntegerField("");
	jPercentIgnore.addCaretListener(listener);

	jClose = new JButton(TabsStockpile.get().close());
	jClose.setActionCommand(StockpileShoppingListAction.CLOSE.name());
	jClose.addActionListener(listener);

	jText = new JTextArea();
	jText.setEditable(false);
	jText.setFont(jPanel.getFont());
	jText.setBackground(jPanel.getBackground());

	JScrollPane jTextScroll = new JScrollPane(jText);

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addGroup(layout.createSequentialGroup()
				.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
					.addComponent(jCopyToClipboard)
					.addComponent(jEveMultiBuy)
				)
				.addGap(0, 0, Integer.MAX_VALUE)
				.addGroup(layout.createParallelGroup()
					.addComponent(jFullLabel)
					.addComponent(jIgnoreLabel)
				)
				.addGroup(layout.createParallelGroup()
					.addComponent(jPercentFull, 100, 100, 100)
					.addComponent(jPercentIgnore, 100, 100, 100)
				)
				.addGroup(layout.createParallelGroup()
					.addComponent(jFullPercentLabel)
					.addComponent(jIgnorePercentLabel)
				)
			)
			.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
				.addComponent(jTextScroll, 500, 500, Integer.MAX_VALUE)
				.addComponent(jClose)
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addGroup(layout.createParallelGroup()
				.addComponent(jCopyToClipboard, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jFullLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jPercentFull, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jFullPercentLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addGroup(layout.createParallelGroup()
				.addComponent(jEveMultiBuy, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jIgnoreLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jPercentIgnore, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jIgnorePercentLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addComponent(jTextScroll, 400, 400, Integer.MAX_VALUE)
			.addComponent(jClose, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
	);
}
 
Example 13
Source File: CreateFromTextDialog.java    From chipster with MIT License 4 votes vote down vote up
public CreateFromTextDialog(ClientApplication clientApplication) {
    super(Session.getSession().getFrames().getMainFrame(), true);

    this.setTitle("Create dataset from text");
    this.setModal(true);
    
    // Layout
    GridBagConstraints c = new GridBagConstraints();
    this.setLayout(new GridBagLayout());
    
    // Name label
    nameLabel = new JLabel("Filename");
    c.anchor = GridBagConstraints.WEST;
    c.insets.set(10, 10, 5, 10);
    c.gridx = 0; 
    c.gridy = 0;
    this.add(nameLabel, c);
    
    // Name field
    nameField = new JTextField();
    nameField.setPreferredSize(new Dimension(150, 20));
    nameField.setText("data.txt");
    nameField.addCaretListener(this);
    c.insets.set(0,10,10,10);       
    c.gridy++;
    this.add(nameField, c);
    
    // Folder to store the file
    folderNameCombo = new JComboBox(ImportUtils.getFolderNames(true).toArray());
    folderNameCombo.setPreferredSize(new Dimension(150, 20));
    folderNameCombo.setEditable(true);
    c.insets.set(10,10,5,10);
    c.gridy++;
    this.add(new JLabel("Create in folder"), c);
    c.insets.set(0,10,10,10);
    c.gridy++;
    this.add(folderNameCombo,c);
    
    // Text label
    textLabel = new JLabel("Text");
    c.anchor = GridBagConstraints.WEST;
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(textLabel, c);
    
    // Text area
    textArea = new JTextArea();
    textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    textArea.setBorder(BorderFactory.createEmptyBorder());
    textArea.addCaretListener(this);
    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    areaScrollPane.setHorizontalScrollBarPolicy(
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    areaScrollPane.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    areaScrollPane.setPreferredSize(new Dimension(570, 300));
    c.insets.set(0,10,10,10);  
    c.gridy++;
    this.add(areaScrollPane, 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);
    
    // Import checkbox
    importCheckBox = new JCheckBox("Import as plain text");
    importCheckBox.setSelected(true);
    c.insets.set(10, 10, 5, 10);
    c.gridy++;
    this.add(importCheckBox, c);
    
    // 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);
    
    // Show
    this.pack();
    this.setResizable(false);
    Session.getSession().getFrames().setLocationRelativeToMainFrame(this);
    
    // Default focus
    textArea.requestFocusInWindow();
    this.setVisible(true);
}
 
Example 14
Source File: UI.java    From PewCrypt with MIT License 4 votes vote down vote up
/**
 * 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 15
Source File: AboutPage.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
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 16
Source File: TextComponent.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
public TextComponent() {
  textArea = new JTextArea(5, 30);
  textArea.setFont(smallFont);
  getViewport().add(textArea);
}
 
Example 17
Source File: XTextAreaPeer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}
 
Example 18
Source File: XTextAreaPeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}
 
Example 19
Source File: AboutPanel.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public AboutPanel(FreeColClient freeColClient) {
    super(freeColClient, null, new MigLayout("wrap"));

    // Header with image
    JLabel apLogoLabel = new JLabel(new ImageIcon(ImageLibrary
            .getUnscaledImage("image.flavor.Title")));
    apLogoLabel.setBorder(
        new CompoundBorder(new EmptyBorder(2,2,2,2),
                           new BevelBorder(BevelBorder.LOWERED)));
    add(apLogoLabel, "center");

    // Create available Font choices
    Font fontBold = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
        FontLibrary.FontSize.TINY, Font.BOLD,
        getImageLibrary().getScaleFactor());
    Font fontNormal = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
        FontLibrary.FontSize.TINY, getImageLibrary().getScaleFactor());

    // Version
    JLabel apVersion = Utility.localizedLabel("aboutPanel.version");
    apVersion.setFont(fontBold);
    JLabel apRevision = new JLabel(FreeCol.getRevision());
    apRevision.setFont(fontNormal);
    add(apVersion, "newline 20");
    add(apRevision, "newline");

    // Official Site Link
    JLabel apOfficialSite = Utility.localizedLabel("aboutPanel.officialSite");
    apOfficialSite.setFont(fontBold);
    add(apOfficialSite, "newline 10");
    JButton apSiteURL = Utility.getLinkButton(SITE_URL, null, SITE_URL);
    apSiteURL.addActionListener(this);
    apSiteURL.setFont(fontNormal);
    add(apSiteURL, "newline");

    // SourceForge Project Site Link
    JLabel apSFProject = Utility.localizedLabel("aboutPanel.sfProject");
    apSFProject.setFont(fontBold);
    add(apSFProject, "newline 10");
    JButton apProjectURL = Utility.getLinkButton(PROJECT_URL, null, PROJECT_URL);
    apProjectURL.addActionListener(this);
    apProjectURL.setFont(fontNormal);
    add(apProjectURL, "newline");

    //GitHub Mirror
    JLabel apGitHubButton = Utility.localizedLabel("aboutPanel.github");
    apGitHubButton.setFont(fontBold);
    add(apGitHubButton, "newline 10");
    JButton apGitHubURL = Utility.getLinkButton(GITHUB_URL, null, GITHUB_URL);
    apGitHubURL.addActionListener(this);
    apGitHubURL.setFont(fontNormal);
    add(apGitHubURL, "newline");

    // Manual
    JLabel apManual = Utility.localizedLabel("aboutPanel.manual");
    apManual.setFont(fontBold);
    add(apManual, "newline 10");
    JButton apManualURL = Utility.getLinkButton(MANUAL_URL, null,
                                                MANUAL_URL);
    apManualURL.addActionListener(this);
    add(apManualURL, "newline");

    // License Disclaimer
    JTextArea apLegal = Utility.localizedTextArea("aboutPanel.legalDisclaimer");
    apLegal.setFont(fontNormal);
    add(apLegal, "newline 20, width 300px");

    // Copyright
    JLabel apCopyright = Utility.localizedLabel("aboutPanel.copyright");
    apCopyright.setFont(fontNormal);
    add(apCopyright, "newline 10");

    add(okButton, "newline 20, tag ok");
}
 
Example 20
Source File: XTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}