Java Code Examples for javax.swing.JButton#setContentAreaFilled()

The following examples show how to use javax.swing.JButton#setContentAreaFilled() . 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: BrowserMenu.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JComponent createConfigureButton() {
    if( null == browserProvider || !browserProvider.hasCustomizer() )
        return null;
    JButton button = new JButton(NbBundle.getMessage(BrowserMenu.class, "Ctl_ConfigurePhoneGap"));
    button.addActionListener( new ActionListener() {

        @Override
        public void actionPerformed( ActionEvent e ) {
            browserProvider.customize();
        }
    });
    button.setBorder( new EmptyBorder(1, 1, 1, 1) );
    button.setMargin( new Insets(0, 0, 0, 0) );

    button.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
    button.setHorizontalAlignment( JLabel.LEFT );
    button.setFocusable( false );

    button.setBorderPainted( false );
    button.setFocusPainted( false );
    button.setRolloverEnabled( true );
    button.setContentAreaFilled( false );

    return button;
}
 
Example 2
Source File: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addActions(JToolBar tb, Action[] actions) {
    tb.removeAll();
    boolean visible = false;
    if (actions != null) {
        for (Action a : actions) {
            if (a != null) {
                JButton btn = tb.add(a);
                btn.setBorder(new javax.swing.border.EmptyBorder(0, 2, 0, 2));
                btn.setBorderPainted(false);
                btn.setContentAreaFilled(false);
                btn.setRolloverEnabled(false);
                btn.setOpaque(false);
                btn.setFocusable(false);
                visible = true;
            } else {
                tb.add(new JSeparator(JSeparator.VERTICAL));
            }
        }
    }
    tb.setVisible(visible);
}
 
Example 3
Source File: GoToRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param value Detection.
 * @return Button for the detection.
 */
private JButton getButton(Object value) {
  if (buttons.containsKey(value)) {
    return buttons.get(value);
  }
  String actionCommand = constructActionCommand(value);
  if (actionCommand == null) {
    return null;
  }
  JButton button = new JButton(Utilities.getImageIcon(
      (textPane != null) ? "gnome-edit-find.png" : "gnome-system-run.png",
      EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  button.setActionCommand(actionCommand);
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "goTo", "actionCommand"));
  buttons.put(value, button);
  return button;
}
 
Example 4
Source File: FlatTitlePane.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
protected JButton createButton( String iconKey, String accessibleName, ActionListener action ) {
	JButton button = new JButton( UIManager.getIcon( iconKey ) );
	button.setFocusable( false );
	button.setContentAreaFilled( false );
	button.setBorder( BorderFactory.createEmptyBorder() );
	button.putClientProperty( AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName );
	button.addActionListener( action );
	return button;
}
 
Example 5
Source File: FindInQueryBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void processMouseEvent(MouseEvent evt, boolean over) {
    Object src = evt.getSource();
    if (src instanceof JButton) {
        JButton button = (JButton)src;
        button.setContentAreaFilled(over);
        button.setBorderPainted(over);
    }
}
 
Example 6
Source File: OpenStegoFrame.java    From openstego with GNU General Public License v2.0 5 votes vote down vote up
private Component createAccordionHeader(String name) {
    GradientPanel panel = new GradientPanel((new JPanel()).getBackground(), (new JPanel()).getBackground().darker());
    panel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.DARK_GRAY));
    panel.setLayout(new GridLayout(1, 1));

    JButton button = new JButton(name);
    button.setContentAreaFilled(false);
    button.setOpaque(false);
    button.setMargin(new Insets(3, 3, 3, 3));
    button.setFont(button.getFont().deriveFont(Font.BOLD));
    button.setFocusable(false);
    panel.add(button);

    return panel;
}
 
Example 7
Source File: LauncherFrame.java    From usergrid with Apache License 2.0 5 votes vote down vote up
public void initButton( JButton button ) {
    button.setPreferredSize( new Dimension( 64, 64 ) );
    button.setMargin( new Insets( 8, 8, 8, 8 ) );
    button.setOpaque( false );
    button.setFocusPainted( false );
    button.setBorderPainted( false );
    button.setContentAreaFilled( false );
    button.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 0 ) );
}
 
Example 8
Source File: hover_press_utilclass.java    From java-QQ- with Apache License 2.0 5 votes vote down vote up
public static JButton getbtnMin() {
	
	JButton button=new JButton();
	button.setIcon(new ImageIcon("image/min.png"));
	button.setPressedIcon(new ImageIcon("image/min_press.png"));
	button.setRolloverIcon(new ImageIcon("image/min_hover.png"));
	button.setToolTipText("����");
	button.setBorder(null);
	button.setFocusPainted(false);
	button.setContentAreaFilled(false);
	return button;
	
}
 
Example 9
Source File: PalettePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void prepareSearchPanel() {
    if( searchpanel == null ) {
        searchpanel = new SearchPanel();

        JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N
        searchpanel.setLayout(new GridBagLayout());
        searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
        lbl.setLabelFor(searchTextField);
        searchTextField.setColumns(10);
        searchTextField.setMaximumSize(searchTextField.getPreferredSize());
        searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N
        lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

        JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true));
        btnCancel.setBorder(BorderFactory.createEmptyBorder());
        btnCancel.setBorderPainted(false);
        btnCancel.setOpaque(false);
        btnCancel.setContentAreaFilled(false);
        searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                removeSearchField();
            }
        });
    }
}
 
Example 10
Source File: VistaSearchDialog.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private TitleBar(String title) {
    this.title = title;
    setName("vistaTitleBar");
    setFont(new Font("Dialog", Font.BOLD, 12));
    setLayout(new GridBagLayout());

    JButton button = new JButton();
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorder(null);
    button.setIconTextGap(0);
    button.setVerticalAlignment(SwingConstants.TOP);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setIcon(new ImageIcon(getClass().getResource("close-title-bar.png")));
    button.setRolloverIcon(new ImageIcon(getClass().getResource("close-title-bar-rollover.png")));
    button.setOpaque(false);
    button.setName("vistaCloseButton");
    add(Box.createVerticalStrut(24),
        new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
                               GridBagConstraints.LINE_START,
                               GridBagConstraints.HORIZONTAL,
                               new Insets(0, 0, 0, 0), 0, 0));
    add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
                                       GridBagConstraints.FIRST_LINE_END,
                                       GridBagConstraints.VERTICAL,
                                       new Insets(0, 0, 0, 0), 0, 0));
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VistaSearchDialog.this.setVisible(false);
        }
    });

    Locator locator = new Locator();
    addMouseListener(locator);
    addMouseMotionListener(locator);
}
 
Example 11
Source File: LayerListRowPanel.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
public LayerListRowPanel(LayerEventsListener layerListener, final NwwPanel wwdPanel, final Layer layer) {
    super(new BorderLayout(10, 10));

    SelectLayerAction action = new SelectLayerAction(layerListener, wwdPanel.getWwd(), layer, layer.isEnabled());
    JCheckBox checkBox = new JCheckBox(action);
    checkBox.setSelected(action.isSelected());
    add(checkBox, BorderLayout.CENTER);

    JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    add(buttonsPanel, BorderLayout.EAST);

    if (layer instanceof NwwVectorLayer) {
        StyleVectorLayerAction styleVectorLayerAction = new StyleVectorLayerAction(wwdPanel,
                (NwwVectorLayer) layer);
        JButton styleButton = new JButton(styleVectorLayerAction);
        styleButton.setBorderPainted(false);
        styleButton.setFocusPainted(false);
        styleButton.setContentAreaFilled(false);
        buttonsPanel.add(styleButton);
    }

    if (layer instanceof NwwLayer) {
        ZoomToLayerAction zoomToLayerAction = new ZoomToLayerAction(wwdPanel, (NwwLayer) layer);
        JButton zoomToButton = new JButton(zoomToLayerAction);
        zoomToButton.setBorderPainted(false);
        zoomToButton.setFocusPainted(false);
        zoomToButton.setContentAreaFilled(false);
        buttonsPanel.add(zoomToButton);
    }
    
    DeleteLayerAction deleteAction = new DeleteLayerAction(layerListener, wwdPanel.getWwd(), layer);
    JButton deleteButton = new JButton(deleteAction);
    deleteButton.setBorderPainted(false);
    deleteButton.setFocusPainted(false);
    deleteButton.setContentAreaFilled(false);
    buttonsPanel.add(deleteButton);
}
 
Example 12
Source File: geGuidePanel.java    From osrsclient with GNU General Public License v2.0 4 votes vote down vote up
public geGuidePanel()  {
    setLayout(new MigLayout("ins 5, center"));
    setBackground(Color.black);
    Border loweredbevel = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
    Font f = new Font(new JLabel().getFont().getFontName(), Font.BOLD, new JLabel().getFont().getSize() + 2);
    ImageIcon searchicon = new ImageIcon(getClass().getClassLoader().getResource("resources/searchicon20.png"));

    itemInputField = new JTextField();
    itemLabel = new JLabel("ITEM:");
    searchButton = new JButton();
   
    priceLabel = new JLabel("PRICE:");
    priceLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
    priceLabel.setForeground(Color.white);
    
    lowAlchLabel = new JLabel("Low Alchemy:");
    lowAlchLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
    lowAlchLabel.setForeground(Color.white);
    
    highAlchLabel = new JLabel("High Alchemy:");
    highAlchLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
    highAlchLabel.setForeground(Color.white);
    
    updateLabel = new JLabel("Last updated:");
    updateLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));
    updateLabel.setForeground(Color.white);
    
    itemInputField.setBorder(loweredbevel);
    itemInputField.setBackground(new Color(101, 101, 101));
    
    itemLabel.setForeground(Color.white);
    itemLabel.setFont(new Font(itemLabel.getFont().getFontName(), Font.BOLD, itemLabel.getFont().getSize()));

    searchButton.setIcon(new javax.swing.ImageIcon(getClass().getClassLoader().getResource("resources/searchiconsquare3.png")));
    searchButton.setBorderPainted(false);
    searchButton.setFocusPainted(false);
    searchButton.setContentAreaFilled(false);
  
    add(itemLabel, "cell 0 0, gap 0, align left");
    add(searchButton, "cell 2 0,align right ");
    add(itemInputField, "width 60%, cell 1 0,align left,");
    
    add(priceLabel, "newline, spanx");
    add(lowAlchLabel, "newline, spanx");
    add(highAlchLabel, "newline, spanx");
    add(updateLabel, "newline, spanx");
    
    searchButton.addActionListener(new ItemSearchListener());
    itemInputField.addActionListener(new ItemSearchListener());

    isValidItem = false;
    setupAnimation();
  
}
 
Example 13
Source File: ConnectionTagEditPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Adds a tag UI element for the given String
 *
 * @param tag
 * 		the tag to create
 * @param pos
 * 		the position at which to insert the tag, or -1 to append the component to the end
 */
private void addTag(String tag, int pos) {
	JLabel tagLabel = new JLabel(tag);
	tagLabel.setFont(OPEN_SANS_13);
	tagLabel.setForeground(isEnabled ? TAG_FOREGROUND : TAG_FOREGROUND_DISABLED);
	// Add border for more space
	Border border = BorderFactory.createEmptyBorder(2, editable ? 3 : 10, 3, 11);

	JPanel roundBackground = new JPanel(new BorderLayout()) {
		@Override
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			Graphics2D g2 = (Graphics2D) g;
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			g2.setPaint(isEnabled ? TAG_BACKGROUND : TAG_BACKGROUND_DISABLED);
			// Prevent it from being cut off
			g2.fill(new RoundRectangle2D.Double(0, 0, getWidth() - 1, getHeight() - 1, 6, 6));
		}
	};

	tagLabel.setBorder(border);
	roundBackground.add(tagLabel, BorderLayout.CENTER);
	JButton removeTag = new JButton(CLOSE_SYMBOL);

	if (editable) {
		roundBackground.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		roundBackground.setBackground(getBackground());
		removeTag.setFont(CLOSE_FONT.deriveFont(1f * removeTag.getFont().getSize()));
		removeTag.setContentAreaFilled(false);
		removeTag.setBorderPainted(false);
		removeTag.setBorder(BorderFactory.createLineBorder(getBackground()));
		roundBackground.add(removeTag, BorderLayout.WEST);
		tagToValue.put(roundBackground, tag);
		removeTag.addActionListener(e -> SwingTools.invokeLater(() -> {
			tagToValue.remove(roundBackground);
			remove(roundBackground);
			setTags.accept(new ArrayList<>(tagToValue.values()));
			revalidate();
			repaint();
		}));
		add(roundBackground, pos);
	} else {
		JPanel spacer = new JPanel(new BorderLayout());
		spacer.setBackground(getBackground());
		spacer.add(roundBackground, BorderLayout.CENTER);
		// Don't use FlowLayout gaps in view mode since they are also added to the top and left side
		spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5));
		add(spacer, pos);
	}

}
 
Example 14
Source File: BeltColumnStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		JFreeChart chartOrNull = getModel().getChartOrNull(i);
		if (chartOrNull != null) {
			final ChartPanel chartPanel = new ChartPanel(chartOrNull) {

				private static final long serialVersionUID = -6953213567063104487L;

				@Override
				public Dimension getPreferredSize() {
					return DIMENSION_CHART_PANEL_ENLARGED;
				}
			};
			chartPanel.setPopupMenu(null);
			chartPanel.setBackground(COLOR_TRANSPARENT);
			chartPanel.setOpaque(false);
			chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			panel.add(chartPanel, BorderLayout.CENTER);

			JPanel openChartPanel = new JPanel(new GridBagLayout());
			openChartPanel.setOpaque(false);

			GridBagConstraints gbc = new GridBagConstraints();
			gbc.anchor = GridBagConstraints.CENTER;
			gbc.fill = GridBagConstraints.NONE;
			gbc.weightx = 1.0;
			gbc.weighty = 1.0;

			JButton openChartButton = new JButton(OPEN_CHART_ACTION);
			openChartButton.setOpaque(false);
			openChartButton.setContentAreaFilled(false);
			openChartButton.setBorderPainted(false);
			openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
			openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
			openChartButton.setIcon(null);
			Font font = openChartButton.getFont();
			Map attributes = font.getAttributes();
			attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
			openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

			openChartPanel.add(openChartButton, gbc);

			panel.add(openChartPanel, BorderLayout.SOUTH);
		}
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 15
Source File: AnimationController.java    From pumpernickel with MIT License 4 votes vote down vote up
/**
 * Format animation controls and add them to a container. This includes
 * assigning the borders of all the components, assigning the PanelUI of the
 * container, assigning the preferred size of the container, and making a
 * spacebar on the slider trigger the toggle play button.
 * 
 * @param container
 *            this container is emptied, assigned a GridBagLayout, and the
 *            other arguments are added to this container.
 * @param togglePlayButton
 *            this button will be the left-most button. It is expected to
 *            always be visible.
 * @param buttons
 *            an optional collection of buttons to display after the
 *            togglePlayButton.
 * @param slider
 *            the slider that stretches to fill the remaining width.
 */
public static void format(JPanel container, final JButton togglePlayButton,
		JButton[] buttons, JSlider slider) {
	if (buttons == null)
		buttons = new JButton[] {};
	container.setUI(new GradientPanelUI(new Color(0xebebeb), Color.white));
	container.removeAll();
	container.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.weighty = 1;
	c.fill = GridBagConstraints.VERTICAL;
	container.add(togglePlayButton, c);
	for (int a = 0; a < buttons.length; a++) {
		c.gridx++;
		container.add(buttons[a], c);
		buttons[a].setOpaque(false);
		buttons[a].setContentAreaFilled(false);
		buttons[a].setRolloverIcon(new DarkenedIcon(buttons[a], .5f));
		buttons[a].setPressedIcon(new DarkenedIcon(buttons[a], .75f));
		buttons[a].setBorder(new PartialLineBorder(Color.gray, new Insets(
				1, 0, 1, 1)));
	}
	c.weightx = 1;
	c.gridx++;
	c.fill = GridBagConstraints.BOTH;
	container.add(slider, c);

	togglePlayButton.setOpaque(false);
	togglePlayButton.setContentAreaFilled(false);
	togglePlayButton.setBorder(new LineBorder(Color.gray));
	slider.setOpaque(false);
	slider.setBorder(new PartialLineBorder(Color.gray, new Insets(1, 0, 1,
			1)));
	Dimension d = slider.getPreferredSize();
	d.width = 60;
	d.height = 25;
	slider.setPreferredSize((Dimension) d.clone());
	d.width = d.height;
	togglePlayButton.setPreferredSize(d);
	for (int a = 0; a < buttons.length; a++) {
		buttons[a].setPreferredSize(d);
	}

	InputMap inputMap = slider.getInputMap(JComponent.WHEN_FOCUSED);
	inputMap.put(KeyStroke.getKeyStroke(' '), "togglePlay");
	slider.getActionMap().put("togglePlay", new AbstractAction() {
		private static final long serialVersionUID = 1L;

		public void actionPerformed(ActionEvent e) {
			togglePlayButton.doClick();
		}
	});

	togglePlayButton.setFocusPainted(false);
	setInsetFocusBorder(togglePlayButton);
	for (JButton button : buttons) {
		button.setFocusPainted(false);
		setInsetFocusBorder(button);
	}
	setInsetFocusBorder(slider);
}
 
Example 16
Source File: ButtonDecotrator.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/** Removes background and border, changes cursor to hand. */
public static void decorateAsLinkButton(JButton button) {
	button.setBorderPainted(false);
	button.setContentAreaFilled(false);
	button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
 
Example 17
Source File: AttributeStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

			private static final long serialVersionUID = -6953213567063104487L;

			@Override
			public Dimension getPreferredSize() {
				return DIMENSION_CHART_PANEL_ENLARGED;
			}
		};
		chartPanel.setPopupMenu(null);
		chartPanel.setBackground(COLOR_TRANSPARENT);
		chartPanel.setOpaque(false);
		chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		panel.add(chartPanel, BorderLayout.CENTER);

		JPanel openChartPanel = new JPanel(new GridBagLayout());
		openChartPanel.setOpaque(false);

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.anchor = GridBagConstraints.CENTER;
		gbc.fill = GridBagConstraints.NONE;
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;

		JButton openChartButton = new JButton(OPEN_CHART_ACTION);
		openChartButton.setOpaque(false);
		openChartButton.setContentAreaFilled(false);
		openChartButton.setBorderPainted(false);
		openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
		openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
		openChartButton.setIcon(null);
		Font font = openChartButton.getFont();
		Map attributes = font.getAttributes();
		attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
		openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

		openChartPanel.add(openChartButton, gbc);

		panel.add(openChartPanel, BorderLayout.SOUTH);
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 18
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 19
Source File: FrameDemo.java    From littleluck with Apache License 2.0 4 votes vote down vote up
private static JFrame createFrame() {

        //<snip>Create frame and set simple properties
        JFrame frame = new JFrame("Demo JFrame");
        frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        //</snip>

        //<snip>Set Minimized/titlebar icon Image
        //Note: How the image is used is platform-dependent
        Image iconImage = null;
        try {
            // todo: swingingduke.gif doesn't exist 
            URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif");
            iconImage = ImageIO.read(imageURL);
        } catch (Exception e) {
            // handle image IO exception
        }
        frame.setIconImage(iconImage);
        //</snip>

        //<snip>Make toplevel "busy"
        // busy glasspane is initially invisible
        frame.setGlassPane(new BusyGlass());
        //</snip>

        //<snip>Add a menubar
        JMenuBar menubar = new JMenuBar();
        frame.setJMenuBar(menubar);
        JMenu menu = new JMenu("File");
        menubar.add(menu);
        menu.add("Open");
        menu.add("Save");
        //</snip>

        //<snip>Add a horizontal toolbar
        JToolBar toolbar = new JToolBar();
        frame.add(toolbar, BorderLayout.NORTH);
        JButton btn = new JButton("Toolbar Button");
        btn.setContentAreaFilled(false);
        toolbar.add(btn);
        //</snip>

        //<snip>Add the content area
        JLabel label = new JLabel("I'm content but a little blue.");
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setPreferredSize(new Dimension(300, 160));
        label.setBackground(new Color(197, 216, 236));
        label.setOpaque(true); // labels non-opaque by default
        frame.add(label);
        //snip

        //<snip>Add a statusbar
        JLabel statusLabel = new JLabel("I show status.");
        statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
        statusLabel.setHorizontalAlignment(JLabel.LEADING);
        frame.add(statusLabel, BorderLayout.SOUTH);
        //</snip>

        //<snip>Initialize frame's size to fit it's content
        frame.pack();
        //</snip>

        return frame;
    }
 
Example 20
Source File: LuckTitlePanel.java    From littleluck with Apache License 2.0 3 votes vote down vote up
/**
 * <p>设置按钮属性</p>
 *
 * <p>set window button attribute</p>
 *
 * @param btn
 */
protected void setBtnAtrr(JButton btn)
{
    btn.setOpaque(false);

    btn.setBorder(null);

    btn.setFocusPainted(false);

    btn.setFocusable(false);

    btn.setBackground(null);

    btn.setContentAreaFilled(false);
}