javax.swing.JButton#setFocusPainted ( )源码实例Demo

下面列出了javax.swing.JButton#setFocusPainted ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nordpos   文件: JProductsSelector.java
public void addProduct(Image img, String name, ActionListener al) {
    
    JButton btn = new JButton();
    btn.applyComponentOrientation(getComponentOrientation());
    btn.setText(name);
    btn.setFont(btn.getFont().deriveFont((float)24));
    btn.setIcon(new ImageIcon(img));
    btn.setFocusPainted(false);
    btn.setFocusable(false);
    btn.setRequestFocusEnabled(false);
    btn.setHorizontalTextPosition(SwingConstants.CENTER);
    btn.setVerticalTextPosition(SwingConstants.BOTTOM);
    btn.setMargin(new Insets(2, 2, 2, 2));
    btn.setMaximumSize(new Dimension(80, 70));
    btn.setPreferredSize(new Dimension(80, 70));
    btn.setMinimumSize(new Dimension(80, 70));
    btn.addActionListener(al);
    flowpanel.add(btn);        
}
 
源代码2 项目: android-classyshark   文件: Toolbar.java
private JButton buildBackButton() {
    JButton result = new JButton(theme.getBackIcon());
    result.setToolTipText("Back");

    result.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            toolbarController.onGoBackPressed();
        }
    });

    result.setBorderPainted(false);
    result.setFocusPainted(true);
    result.setEnabled(false);

    return result;
}
 
源代码3 项目: jaamsim   文件: GUIFrame.java
private void addFileSaveButton(JToolBar buttonBar, Insets margin) {
	fileSave = new JButton( new ImageIcon(
			GUIFrame.class.getResource("/resources/images/Save-16.png")) );
	fileSave.setMargin(margin);
	fileSave.setFocusPainted(false);
	fileSave.setToolTipText(formatToolTip("Save (Ctrl+S)", "Saves the present model."));
	fileSave.setEnabled(false);
	fileSave.addActionListener( new ActionListener() {

		@Override
		public void actionPerformed( ActionEvent event ) {
			GUIFrame.this.save();
			controlStartResume.requestFocusInWindow();
		}
	} );
	buttonBar.add( fileSave );
}
 
源代码4 项目: filthy-rich-clients   文件: TwoStopsGradient.java
/** Creates a new instance of TwoStopsGradient */
public TwoStopsGradient() {
    super("Two Stops Gradient");
    
    JPanel panel = new JPanel(new GridBagLayout());
    JButton button;
    panel.add(button = new DepthButton("New"),
            new GridBagConstraints(0, 0, 1, 1,
                0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.NONE, new Insets(3, 3, 3, 3), 0, 0));
    button.setFocusPainted(false);
    panel.add(button = new DepthButton("Open"),
            new GridBagConstraints(1, 0, 1, 1,
                0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.NONE, new Insets(3, 3, 3, 3), 0, 0));
    button.setFocusPainted(false);
    panel.add(button = new DepthButton("Save"),
            new GridBagConstraints(2, 0, 1, 1,
                0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.NONE, new Insets(3, 3, 3, 3), 0, 0));
    button.setFocusPainted(false);
    
    add(panel);
    setSize(320, 240);
}
 
源代码5 项目: jaamsim   文件: GUIFrame.java
private void addFileOpenButton(JToolBar buttonBar, Insets margin) {
	JButton fileOpen = new JButton( new ImageIcon(
			GUIFrame.class.getResource("/resources/images/Open-16.png")) );
	fileOpen.setMargin(margin);
	fileOpen.setFocusPainted(false);
	fileOpen.setToolTipText(formatToolTip("Open... (Ctrl+O)", "Opens a model."));
	fileOpen.addActionListener( new ActionListener() {

		@Override
		public void actionPerformed( ActionEvent event ) {
			GUIFrame.this.load();
			controlStartResume.requestFocusInWindow();
		}
	} );
	buttonBar.add( fileOpen );
}
 
源代码6 项目: nordpos   文件: Place.java
public void readValues(DataRead dr) throws BasicException {
    m_sId = dr.getString(1);
    m_sName = dr.getString(2);
    m_ix = dr.getInt(3).intValue();
    m_iy = dr.getInt(4).intValue();
    m_sfloor = dr.getString(5);
    
    m_bPeople = false;
    m_btn = new JButton();

    m_btn.setFocusPainted(false);
    m_btn.setFocusable(false);
    m_btn.setRequestFocusEnabled(false);
    m_btn.setHorizontalTextPosition(SwingConstants.CENTER);
    m_btn.setVerticalTextPosition(SwingConstants.BOTTOM);            
    m_btn.setIcon(ICO_FRE);
    m_btn.setText(m_sName);
}
 
源代码7 项目: jaamsim   文件: GUIFrame.java
private void addFontColourButton(JToolBar buttonBar, Insets margin) {

		colourIcon = new ColorIcon(16, 16);
		colourIcon.setFillColor(Color.LIGHT_GRAY);
		colourIcon.setOutlineColor(Color.LIGHT_GRAY);
		fontColour = new JButton(colourIcon);
		fontColour.setMargin(margin);
		fontColour.setFocusPainted(false);
		fontColour.setRequestFocusEnabled(false);
		fontColour.setToolTipText(formatToolTip("Font Colour", "Sets the colour of the text."));
		fontColour.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed( ActionEvent event ) {
				if (!(selectedEntity instanceof TextEntity))
					return;
				final TextEntity textEnt = (TextEntity) selectedEntity;
				final Color4d presentColour = textEnt.getFontColor();
				ArrayList<Color4d> coloursInUse = GUIFrame.getFontColoursInUse(sim);
				ColourMenu fontMenu = new ColourMenu(presentColour, coloursInUse, true) {

					@Override
					public void setColour(String colStr) {
						KeywordIndex kw = InputAgent.formatInput("FontColour", colStr);
						InputAgent.storeAndExecute(new KeywordCommand(selectedEntity, kw));
					}

				};
				fontMenu.show(fontColour, 0, fontColour.getPreferredSize().height);
				controlStartResume.requestFocusInWindow();
			}
		});

		buttonBar.add( fontColour );
	}
 
源代码8 项目: xdm   文件: SettingsPage.java
private JButton createButton2(String name) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	btn.addActionListener(this);
	return btn;
}
 
源代码9 项目: launcher   文件: FatalErrorDialog.java
public FatalErrorDialog addButton(String message, Runnable action)
{
	JButton button = new JButton(message);
	button.addActionListener(e -> action.run());
	button.setFont(font);
	button.setBackground(DARK_GRAY_COLOR);
	button.setForeground(Color.LIGHT_GRAY);
	button.setBorder(BorderFactory.createCompoundBorder(
		BorderFactory.createMatteBorder(1, 0, 0, 0, DARK_GRAY_COLOR.brighter()),
		new EmptyBorder(4, 4, 4, 4)
	));
	button.setAlignmentX(Component.CENTER_ALIGNMENT);
	button.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
	button.setFocusPainted(false);
	button.addChangeListener(ev ->
	{
		if (button.getModel().isPressed())
		{
			button.setBackground(DARKER_GRAY_COLOR);
		}
		else if (button.getModel().isRollover())
		{
			button.setBackground(DARK_GRAY_HOVER_COLOR);
		}
		else
		{
			button.setBackground(DARK_GRAY_COLOR);
		}
	});

	rightColumn.add(button);
	rightColumn.revalidate();

	return this;
}
 
源代码10 项目: osrsclient   文件: MarketPanel.java
private void setup() {
    setLayout(new MigLayout("ins 5, center"));
    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"));

    itemDetailPanel = new ItemDetailPanel();
    itemInputField = new JTextField();
    itemLabel = new JLabel("ITEM:");
    searchButton = new JButton();

    itemDisplayPanel = new ItemListPanel();
    itemInputField.setBorder(loweredbevel);
    itemInputField.setBackground(new Color(51, 51, 51));
    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);

    itemDisplayPanel.setRolloverListener(this);

    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(itemDisplayPanel, "width 100%, height 30%, cell 0 1, center,spanx");
    //30% height on itemDetailPanel leaves ample room at the bottom
    //for a future offer-watcher.
    add(itemDetailPanel, "width 100%, height 50%, cell 0 2, center, spanx");

}
 
源代码11 项目: gcs   文件: OutputPreferences.java
private JButton createHyperlinkButton(String linkText, String tooltip) {
    JButton button = new JButton(String.format("<html><body><font color=\"#000099\"><u>%s</u></font></body></html>", linkText));
    button.setFocusPainted(false);
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setOpaque(false);
    button.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    button.setBackground(Color.white);
    button.addActionListener(this);
    UIUtilities.setToPreferredSizeOnly(button);
    add(button);
    return button;
}
 
源代码12 项目: java-QQ-   文件: hover_press_utilclass.java
public static JButton getbtnButton(String iconpath,String rolloverIconpath,String pressIconpath)
{ 

	JButton button=new JButton();
	button.setIcon(new ImageIcon(iconpath));
	button.setRolloverIcon(new ImageIcon(rolloverIconpath));
    button.setPressedIcon(new ImageIcon(pressIconpath));
    button.setBorder(null);
    button.setFocusPainted(false);
    button.setContentAreaFilled(false);
  
    return button;	

}
 
源代码13 项目: jaamsim   文件: GUIFrame.java
private void addClearFormattingButton(JToolBar buttonBar, Insets margin) {
	clearButton = new JButton(new ImageIcon(
			GUIFrame.class.getResource("/resources/images/Clear-16.png")));
	clearButton.setToolTipText(formatToolTip("Clear Formatting",
			"Resets the format inputs for the selected Entity or DisplayModel to their default "
			+ "values."));
	clearButton.setMargin(margin);
	clearButton.setFocusPainted(false);
	clearButton.setRequestFocusEnabled(false);
	clearButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed( ActionEvent event ) {
			if (selectedEntity == null)
				return;
			ArrayList<KeywordIndex> kwList = new ArrayList<>();
			for (Input<?> in : selectedEntity.getEditableInputs()) {
				String cat = in.getCategory();
				if (in.isDefault() || !cat.equals(Entity.FORMAT) && !cat.equals(Entity.FONT))
					continue;
				KeywordIndex kw = InputAgent.formatArgs(in.getKeyword());
				kwList.add(kw);
			}
			if (kwList.isEmpty())
				return;
			KeywordIndex[] kws = new KeywordIndex[kwList.size()];
			kwList.toArray(kws);
			InputAgent.storeAndExecute(new KeywordCommand(selectedEntity, kws));
			controlStartResume.requestFocusInWindow();
		}
	});
	buttonBar.add( clearButton );
}
 
源代码14 项目: xdm   文件: BatchDownloadWnd.java
private JButton createButton(String name) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	btn.addActionListener(this);
	return btn;
}
 
源代码15 项目: xdm   文件: BatchPatternDialog.java
private JButton createButton(String name) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	btn.addActionListener(this);
	return btn;
}
 
源代码16 项目: PewCrypt   文件: UI.java
/**
 * 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);
}
 
源代码17 项目: littleluck   文件: LuckInternalFrameTitlePane.java
/**
 * set Button attribute.
 *
 * @param btn Button object.
 * @param normalIcon  button icon properties.
 * @param rollverIcon button icon properties when mouse over.
 * @param pressedIcon button icon properties when mouse click.
 */
private void setBtnAtrr(JButton btn,
                        String normalIcon,
                        String rollverIcon,
                        String pressedIcon)
{
    btn.setBorder(null);

    btn.setFocusPainted(false);

    btn.setFocusable(false);

    btn.setBackground(null);

    btn.setContentAreaFilled(false);

    btn.setEnabled(false);

    btn.setIcon(UIManager.getIcon(normalIcon));

    btn.setRolloverIcon(UIManager.getIcon(rollverIcon));

    btn.setPressedIcon(UIManager.getIcon(pressedIcon));

    btn.setEnabled(true);
}
 
源代码18 项目: jaamsim   文件: GUIFrame.java
private void addFontSelector(JToolBar buttonBar, Insets margin) {

		font = new JTextField("");
		font.setEditable(false);
		font.setHorizontalAlignment(JTextField.CENTER);
		font.setPreferredSize(new Dimension(120, fileSave.getPreferredSize().height));
		font.setToolTipText(formatToolTip("Font", "Sets the font for the text."));
		buttonBar.add(font);

		fontSelector = new JButton(new ImageIcon(
				GUIFrame.class.getResource("/resources/images/dropdown.png")));
		fontSelector.setMargin(margin);
		fontSelector.setFocusPainted(false);
		fontSelector.setRequestFocusEnabled(false);
		fontSelector.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed( ActionEvent event ) {
				if (!(selectedEntity instanceof TextEntity))
					return;
				final TextEntity textEnt = (TextEntity) selectedEntity;
				final String presentFontName = textEnt.getFontName();
				ArrayList<String> valuesInUse = GUIFrame.getFontsInUse(sim);
				ArrayList<String> choices = TextModel.validFontNames;
				PreviewablePopupMenu fontMenu = new PreviewablePopupMenu(presentFontName,
						valuesInUse, choices, true) {

					@Override
					public void setValue(String str) {
						font.setText(str);
						String name = Parser.addQuotesIfNeeded(str);
						KeywordIndex kw = InputAgent.formatInput("FontName", name);
						InputAgent.storeAndExecute(new KeywordCommand(selectedEntity, kw));
					}

				};
				fontMenu.show(font, 0, font.getPreferredSize().height);
				controlStartResume.requestFocusInWindow();
			}
		});

		buttonBar.add(fontSelector);
	}
 
源代码19 项目: Darcula   文件: DarculaSplitPaneDivider.java
@Override
protected JButton createRightOneTouchButton() {
    JButton b = new JButton() {
        public void setBorder(Border border) {
        }
        public void paint(Graphics g) {
            if (splitPane != null) {
                int[]          xs = new int[3];
                int[]          ys = new int[3];
                int            blockSize;

                // Fill the background first ...
                g.setColor(this.getBackground());
                g.fillRect(0, 0, this.getWidth(),
                        this.getHeight());

                // ... then draw the arrow.
                if (orientation == JSplitPane.VERTICAL_SPLIT) {
                    blockSize = Math.min(getHeight(), ONE_TOUCH_SIZE);
                    xs[0] = blockSize;
                    xs[1] = blockSize << 1;
                    xs[2] = 0;
                    ys[0] = blockSize;
                    ys[1] = ys[2] = 0;
                }
                else {
                    blockSize = Math.min(getWidth(), ONE_TOUCH_SIZE);
                    xs[0] = xs[2] = 0;
                    xs[1] = blockSize;
                    ys[0] = 0;
                    ys[1] = blockSize;
                    ys[2] = blockSize << 1;
                }
                g.setColor(new DoubleColor(Gray._255, UIUtil.getLabelForeground()));
                g.fillPolygon(xs, ys, 3);
            }
        }
        // Don't want the button to participate in focus traversable.
        public boolean isFocusTraversable() {
            return false;
        }
    };
    b.setMinimumSize(new Dimension(ONE_TOUCH_SIZE, ONE_TOUCH_SIZE));
    b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    b.setFocusPainted(false);
    b.setBorderPainted(false);
    b.setRequestFocusEnabled(false);
    return b;
}
 
源代码20 项目: littleluck   文件: LuckTitlePanel.java
/**
 * <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);
}