当前位置: 首页>>代码示例>>Java>>正文


Java JButton.setFocusPainted方法代码示例

本文整理汇总了Java中javax.swing.JButton.setFocusPainted方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setFocusPainted方法的具体用法?Java JButton.setFocusPainted怎么用?Java JButton.setFocusPainted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setFocusPainted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDetails

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
    try {
        text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
    } catch (CharConversionException ex) {
        throw new IllegalArgumentException(ex);
    }
    if (null == action) {
        return new JLabel(text);
    }
    JButton btn = new JButton(text);
    btn.setFocusable(false);
    btn.setBorder(BorderFactory.createEmptyBorder());
    btn.setBorderPainted(false);
    btn.setFocusPainted(false);
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.addActionListener(action);
    btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
    if (c != null) {
        btn.setForeground(c);
    }
    return btn;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NotificationImpl.java

示例2: createToolBar

import javax.swing.JButton; //导入方法依赖的package包/类
JToolBar createToolBar() {
	JToolBar toolbar = new JToolBar();
	next = new JButton(XDMIconMap.getIcon("NEXT_ICON"));
	XDMToolBarButtonUI btnUI = new XDMToolBarButtonUI();
	next.setUI(btnUI);
	next.addActionListener(this);
	next.setRolloverIcon(XDMIconMap.getIcon("NEXT_R_ICON"));
	next.setContentAreaFilled(false);
	next.setFocusPainted(false);
	back = new JButton(XDMIconMap.getIcon("BACK_ICON"));
	back.setUI(btnUI);
	back.setContentAreaFilled(false);
	back.setFocusPainted(false);
	back.addActionListener(this);
	back.setRolloverIcon(XDMIconMap.getIcon("BACK_R_ICON"));
	toolbar.add(back);
	toolbar.add(next);
	return toolbar;// add(toolbar, BorderLayout.NORTH);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:20,代码来源:HelpDialog.java

示例3: getDetailsPanel

import javax.swing.JButton; //导入方法依赖的package包/类
private static JComponent getDetailsPanel(String summary) {
    JPanel details = new JPanel(new GridBagLayout());
    details.setOpaque(false);
    JLabel lblMessage = new JLabel(summary);
    
    JButton reportLink = new JButton("<html><a href=\"_blank\">" + NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionReport")); //NOI18N
    reportLink.setFocusable(false);
    reportLink.setBorder(BorderFactory.createEmptyBorder());
    reportLink.setBorderPainted(false);
    reportLink.setFocusPainted(false);
    reportLink.setOpaque(false);
    reportLink.setContentAreaFilled(false);
    reportLink.addActionListener(flash);
    reportLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    details.add(reportLink, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    details.add(lblMessage, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    return details;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:NotifyExcPanel.java

示例4: ButtonCellRenderer

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Create the ButtonCellRenderer to be used as a renderer and editor. The
 * renderer and editor will automatically be installed on the TableColumn of
 * the specified column.
 *
 * @param table the table containing the button renderer/editor
 * @param action the Action to be invoked when the button is invoked
 * @param column the column to which the button renderer/editor is added
 */
public ButtonCellRenderer(JTable table, Action action, int column) {
    this.table = table;
    this.action = action;

    renderButton = new JButton();
    editButton = new JButton();
    editButton.setFocusPainted(false);
    editButton.addActionListener(this);
    originalBorder = editButton.getBorder();
    setFocusBorder(new LineBorder(Color.BLUE));

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(column).setCellRenderer(this);
    columnModel.getColumn(column).setCellEditor(this);
    table.addMouseListener(this);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:26,代码来源:ButtonCellRenderer.java

示例5: customizePanel

import javax.swing.JButton; //导入方法依赖的package包/类
public void customizePanel(JPanel valuePanel, Container buttonsPanel) {
     valuePanel.setLayout(new BorderLayout());
     valuePanel.add(jComboBoxColumns);
     jComboBoxColumns.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
             setJavelinZoneFromProperty();
         }
     });
     
     addButton = new JButton();
     addButton.setFocusPainted(false);
     addButton.setEnabled(false);
     addButton.setPreferredSize(new Dimension(24, 24));
     addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/twinsoft/convertigo/eclipse/property_editors/images/table_editor/new_line.png")));
     addButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/com/twinsoft/convertigo/eclipse/property_editors/images/table_editor/new_line.d.png")));
     addButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
             addButtonActionPerformed();
         }
     });
     buttonsPanel.add(addButton);
     
     if (javelin != null) {
javelin.addZoneListener(this);
     }
 }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:ColumnEditor.java

示例6: stylizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * JComponent styling wrappers
 */
public void stylizeButton(JButton b){
	b.setFocusPainted(false);
	b.setFont(font_14_bold);
	b.setForeground(Color.WHITE);
	b.setBackground(new Color(102, 0, 153)); // Purple
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:10,代码来源:TrainModelGUI.java

示例7: ButtonColumn

import javax.swing.JButton; //导入方法依赖的package包/类
public ButtonColumn(JTable table, int column) {
    super();
    this.table = table;
    renderButton = new JButton();
    editButton = new JButton();
    editButton.setFocusPainted(false);
    editButton.addActionListener(this);

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(column).setCellRenderer(this);
    columnModel.getColumn(column).setCellEditor(this);
}
 
开发者ID:rememberber,项目名称:WePush,代码行数:13,代码来源:Init.java

示例8: stylizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
	b.setFocusPainted(false);
	b.setFont(font_16_bold);
	b.setForeground(Color.WHITE);
	b.setBackground(new Color(46, 49, 55));
	b.setEnabled(true);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:8,代码来源:SimulatorGui.java

示例9: createLinkButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Erstellt automatisch einen anklickbaren Link, der aussieht wie ein Label.
 * @param title
 * @param target
 * @return
 */
@SuppressWarnings("SameParameterValue")
private JButton createLinkButton(String title, final URI target)
{
    JButton linkButton = new JButton();
    linkButton.setText("<HTML><FONT color=\"#000099\"><U>" + title + "</U></FONT></HTML>");
    linkButton.setHorizontalAlignment(SwingConstants.LEFT);
    linkButton.setBorderPainted(false);
    linkButton.setOpaque(false);
    linkButton.setBackground(Color.WHITE);
    linkButton.setToolTipText(target.toString());
    linkButton.setFocusPainted(false);
    linkButton.setHorizontalAlignment(JButton.CENTER);
    linkButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            if (Desktop.isDesktopSupported())
            {
                try {
                    Desktop.getDesktop().browse(target);
                } catch (IOException exc) {
                    exc.printStackTrace();
                }
            }
        }
    });

    return linkButton;
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:35,代码来源:AboutPanel.java

示例10: prepareButton

import javax.swing.JButton; //导入方法依赖的package包/类
void prepareButton(JButton btn) {
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setHorizontalAlignment(JButton.CENTER);
	btn.setHorizontalTextPosition(JButton.CENTER);
	btn.setVerticalTextPosition(JButton.BOTTOM);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:8,代码来源:BrowserIntDlg.java

示例11: stylizeButton_Disabled

import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton_Disabled(JButton b){
	b.setFocusPainted(false);
	b.setFont(font_14_bold);
	b.setForeground(Color.GRAY);
	b.setBackground(new Color(50, 0, 70));
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:7,代码来源:TrackControllerGUI.java

示例12: initGUI

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Initialize all gui related stuff
 */
private void initGUI() {
	// Sets default title, close operation and dimensions
	this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
	this.setIconImage(JMTImageLoader.loadImage("Results").getImage());
	this.centerWindow(CommonConstants.MAX_GUI_WIDTH_JSIM_RESULTS, CommonConstants.MAX_GUI_HEIGHT_JSIM_RESULTS);

	// Creates all tabs
	JTabbedPane mainPanel = new JTabbedPane();
	this.getContentPane().setLayout(new BorderLayout());
	this.getContentPane().add(mainPanel, BorderLayout.CENTER);
	addTabPane(mainPanel, SimulationDefinition.MEASURE_QL, DESCRIPTION_QUEUE_LENGTH, results.getQueueLengthMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_QT, DESCRIPTION_QUEUE_TIME, results.getQueueTimeMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_RP, DESCRIPTION_RESPONSE_TIME, results.getResponseTimeMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_RD, DESCRIPTION_RESIDENCE_TIME, results.getResidenceTimeMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_U, DESCRIPTION_UTILIZATION, results.getUtilizationMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_X, DESCRIPTION_THROUGHPUT, results.getThroughputMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_DR, DESCRIPTION_DROP_RATE, results.getDropRateMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_S_CN, DESCRIPTION_SYSTEM_CUSTOMER_NUMBER, results.getSystemCustomerNumberMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RP, DESCRIPTION_SYSTEM_RESPONSE_TIME, results.getSystemResponseTimeMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_S_X, DESCRIPTION_SYSTEM_THROUGHPUT, results.getSystemThroughputMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_S_DR, DESCRIPTION_SYSTEM_DROP_RATE, results.getSystemDropRateMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_S_P, DESCRIPTION_SYSTEM_POWER, results.getSystemPowerMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_RP_PER_SINK, DESCRIPTION_RESPONSE_TIME_PER_SINK, results.getResponsetimePerSinkMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_PER_SINK, results.getThroughputPerSinkMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_FCR_TW, DESCRIPTION_FCR_TOTAL_WEIGHT, results.getFCRTotalWeightMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_FCR_MO, DESCRIPTION_FCR_MEMORY_OCCUPATION, results.getFCRMemoryOccupationMeasures());	
	addTabPane(mainPanel, SimulationDefinition.MEASURE_FJ_CN, DESCRIPTION_FJ_CUSTOMER_NUMBER, results.getFJCustomerNumberMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_FJ_RP, DESCRIPTION_FJ_RESPONSE_TIME, results.getFJResponseTimeMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_FX, DESCRIPTION_FIRING_THROUGHPUT, results.getFiringThroughputMeasures());
	// Creates bottom toolbar
	JToolBar toolbar = new JToolBar();
	toolbar.setFloatable(false);
	toolbar.setRollover(true);
	start = new JButton();
	toolbar.add(start);
	start.setVisible(false);
	pause = new JButton();
	toolbar.add(pause);
	pause.setVisible(false);
	stop = new JButton();
	toolbar.add(stop);
	stop.setVisible(false);
	// Adds a progress bar
	progressBar = new JProgressBar();
	progressBar.setStringPainted(true);
	progressBar.setForeground(Color.BLUE);
	UIManager.put("ProgressBar.selectionForeground", Color.WHITE);
	setProgressBar(results.getProgress(), results.getElapsedTime());
	toolbar.add(progressBar);
	// Add close window button
	JButton close = new JButton();
	close.setIcon(JMTImageLoader.loadImage("Close"));
	close.setFocusPainted(false);
	close.setContentAreaFilled(false);
	close.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	close.setRolloverIcon(JMTImageLoader.loadImage("CloseRO"));
	close.setPressedIcon(JMTImageLoader.loadImage("CloseP"));
	close.setVisible(true);
	close.setToolTipText("Closes this window");
	close.addActionListener(new ActionListener() {
		// Fires a window closing event
		public void actionPerformed(ActionEvent e) {
			ResultsWindow.this.dispatchEvent(new WindowEvent(ResultsWindow.this, WindowEvent.WINDOW_CLOSING));
		}
	});

	toolbar.add(close);
	// Adds toolbar
	this.getContentPane().add(toolbar, BorderLayout.SOUTH);

	// Adds listener for progressBar
	results.setProgressListener(new MeasureDefinition.ProgressListener() {
		public void progressChanged(double progress, long elapsedTime) {
			setProgressBar(progress, elapsedTime);
		}
	});
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:81,代码来源:ResultsWindow.java

示例13: Instructions

import javax.swing.JButton; //导入方法依赖的package包/类
public Instructions(JFrame f, int frameBoundX, int frameBoundY) {
	
	// Font
	InputStream is = Menu.class.getResourceAsStream("Cheap Potatoes.ttf");
	try {
		font = Font.createFont(Font.TRUETYPE_FONT, is);
	} catch (FontFormatException | IOException e1) {
		// TODO Auto-generated catch
		// block
		e1.printStackTrace();
	}
	
	//Main Panel of Instructions Section created here
	JPanel instrPanel = new JPanel();
	instrPanel.setLayout(null);
	setBounds(0,0,frameBoundX, frameBoundY);
	
	//Logo
	JLabel logoLabel = new JLabel("GEOTRIX", SwingConstants.CENTER);
	sizedFont = font.deriveFont(68f);
	logoLabel.setFont(sizedFont);
	logoLabel.setBounds(frameBoundX / 2 - 200, (frameBoundY-520)/ 2, 400, 190);
	
	JButton backButton = new JButton("Back");
	backButton.setBorderPainted(false);
	backButton.setFocusPainted(false);
	backButton.setContentAreaFilled(false);
	sizedFont = font.deriveFont(Font.BOLD, 30f);
	backButton.setFont(sizedFont);
	backButton.setForeground(Color.RED);
	backButton.setBounds(10, 10, 200, 100);
	// when backButton clicked
	backButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			//remove panel
			instrPanel.setVisible(false);
			f.remove(instrPanel);
			new MainMenu(f, frameBoundX, frameBoundY);
		}
	});
	
	//Logo
	JLabel instructionLabel = new JLabel("Arrow keys + Space button", SwingConstants.CENTER);
	sizedFont = font.deriveFont(40f);
	instructionLabel.setFont(sizedFont);
	instructionLabel.setBounds(25, frameBoundY/2 - 100, frameBoundX - 50, 200);
	instrPanel.add(instructionLabel);

	//Background Icon
	String img = "background_revision.jpg";
	ImageIcon imgIc = new ImageIcon(this.getClass().getResource(img));
	
	//Backgroud Label
	JLabel bgLabel = new JLabel(imgIc);
	bgLabel.setBounds(0, 0, frameBoundX, frameBoundY);

	instrPanel.add(backButton);
	instrPanel.add(logoLabel);
	instrPanel.add(bgLabel);
	
	f.add(instrPanel);
	f.revalidate();
	f.setVisible(true);
	
	
}
 
开发者ID:berkunal,项目名称:SWEngProject,代码行数:67,代码来源:Instructions.java

示例14: createButton

import javax.swing.JButton; //导入方法依赖的package包/类
JButton createButton(String name) {
    JButton button = new JButton(name);
    button.setMargin(new Insets(0, 5, 0, 5));
    button.setFocusPainted(false);
    return button;
}
 
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:7,代码来源:ClientUI.java

示例15: createButton

import javax.swing.JButton; //导入方法依赖的package包/类
JButton createButton(String name){
	JButton button=new JButton(name);
	button.setMargin(new Insets(0,5,0,5));
	button.setFocusPainted(false);
	return button;
}
 
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:7,代码来源:SpeedSetFrame.java


注:本文中的javax.swing.JButton.setFocusPainted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。