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


Java JButton.setPressedIcon方法代码示例

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


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

示例1: createCloseButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Creates a small 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createCloseButton() {
    JButton closeButton = new JButton();
    int size = 16;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getCloseTabImage());
    closeButton.setRolloverIcon(getCloseTabRolloverImage());
    closeButton.setPressedIcon(getCloseTabPressedImage());
    return closeButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CloseButtonFactory.java

示例2: createBigCloseButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Creates a big 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createBigCloseButton() {
    JButton closeButton = new JButton();
    int size = 19;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getBigCloseTabImage());
    closeButton.setRolloverIcon(getBigCloseTabRolloverImage());
    closeButton.setPressedIcon(getBigCloseTabPressedImage());
    return closeButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CloseButtonFactory.java

示例3: SplashScreen

import javax.swing.JButton; //导入方法依赖的package包/类
public SplashScreen(Image image) {
	this.icon = new ImageIcon(image);

	Container container = getContentPane();
	container.setLayout(null);

	BufferedImage alphaImage = new BufferedImage(this.icon.getIconWidth(), this.icon.getIconHeight(), 2);
	Graphics2D g = alphaImage.createGraphics();
	g.drawImage(image, 0, 0, this.icon.getIconWidth(), this.icon.getIconHeight(), null);
	g.dispose();

	JButton background = new JButton(new ImageIcon(alphaImage));
	background.setBounds(0, 0, this.icon.getIconWidth(), this.icon.getIconHeight());
	background.setRolloverEnabled(true);
	background.setRolloverIcon(background.getIcon());
	background.setSelectedIcon(background.getIcon());
	background.setDisabledIcon(background.getIcon());
	background.setPressedIcon(background.getIcon());
	background.setFocusable(false);
	background.setContentAreaFilled(false);
	background.setBorderPainted(false);
	background.setOpaque(false);
	container.add(background);

	setSize(this.icon.getIconWidth(), this.icon.getIconHeight() + 20);
	try {
		setBackground(new Color(0, 0, 0, 0));
	} catch (UnsupportedOperationException e) {
		setBackground(new Color(0, 0, 0));
	}
	setLocationRelativeTo(null);
}
 
开发者ID:DivergenceBot,项目名称:Bootstrapper,代码行数:33,代码来源:SplashScreen.java

示例4: createButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createButton(int icon) {
	JButton button = new JButton( Icons.getIcon(icon,false));
	button.setPressedIcon( Icons.getIcon(icon, true) );
	button.setDisabledIcon( Icons.getDisabledIcon( icon, false ));
	button.setBorder( BorderFactory.createLineBorder(Color.black));
	button.setMargin(new Insets(1,0,1,0));
	return button;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:9,代码来源:LayerManager.java

示例5: 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

示例6: initGUI

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Initialize allgui related stuff
 */
private void initGUI() {
	// Sets default title, close operation and dimensions
	this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
	this.setTitle("Simulation Results...");
	this.setIconImage(JMTImageLoader.loadImage("Results").getImage());
	int width = 800, height = 500;
	this.centerWindow(width, height);

	// Creates all tabs
	JTabbedPane mainPanel = new JTabbedPane();
	this.getContentPane().setLayout(new BorderLayout());
	this.getContentPane().add(mainPanel, BorderLayout.CENTER);
	addTabPane(mainPanel, "Number of Customers", DESCRIPTION_QUEUELENGTHS, results.getQueueLengthMeasures());
	addTabPane(mainPanel, "Queue Time", DESCRIPTION_QUEUETIMES, results.getQueueTimeMeasures());
	addTabPane(mainPanel, "Residence Time", DESCRIPTION_RESIDENCETIMES, results.getResidenceTimeMeasures());
	addTabPane(mainPanel, "Response Time", DESCRIPTION_RESPONSETIMES, results.getResponseTimeMeasures());
	addTabPane(mainPanel, "Utilization", DESCRIPTION_UTILIZATIONS, results.getUtilizationMeasures());
	addTabPane(mainPanel, "Throughput", DESCRIPTION_THROUGHPUTS, results.getThroughputMeasures());
	addTabPane(mainPanel, "Drop Rate", DESCRIPTION_DROPRATE, results.getDropRateMeasures());
	addTabPane(mainPanel, "System Response Time", DESCRIPTION_SYSTEMRESPONSETIMES, results.getSystemResponseTimeMeasures());
	addTabPane(mainPanel, "System Throughput", DESCRIPTION_SYSTEMTHROUGHPUTS, results.getSystemThroughputMeasures());
	addTabPane(mainPanel, "System Drop Rate", DESCRIPTION_DROPRATE, results.getSystemDropRateMeasures());
	addTabPane(mainPanel, "System Number of Customers", DESCRIPTION_CUSTOMERNUMBERS, results.getCustomerNumberMeasures());
	//Added by ASHANKA START
	//Adds the System Power panel in the results window
	addTabPane(mainPanel, "System Power", DESCRIPTION_SYSTEMPOWER, results.getSystemPowerMeasures());
	//Added by ASHANKA STOP
	addTabPane(mainPanel, SimulationDefinition.MEASURE_R_PER_SINK, DESCRIPTION_RESPONSETIME_SINK, results.getResponsetimePerSinkMeasures());
	addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_SINK, results.getThroughputPerSinkMeasures());
	// 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);
	setProgressBar(results.getProgressTime());
	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.setProgressTimeListener(new MeasureDefinition.ProgressTimeListener() {
		public void timeChanged(double time) {
			setProgressBar(time);
		}
	});

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:81,代码来源:ResultsWindow.java

示例7: SCSImage2

import javax.swing.JButton; //导入方法依赖的package包/类
public SCSImage2(SCS scs) {
//		***** GMA 1.6.2: Tool tip text
		setToolTipText("Right-click to digitize");
//		***** GMA 1.6.2
		
		this.scs = scs;
		panels = new Vector();
		zoom = zoomX = zoomY = .25;

		addMouseListener(this);
		addMouseMotionListener(this);

//		***** GMA 1.6.2: Add a pop-up menu that appears when a right-click occurs to allow the user 
//		to record the data for a particular point along the selected SCS leg.
		pm = new JPopupMenu();
		JMenuItem mi = new JMenuItem("Copy Information to Clipboard");
		mi.setActionCommand("copy");
		mi.addActionListener(this);
		pm.add(mi);
//		***** GMA 1.6.2
		zoomer = new Zoomer(this);

//		***** Changed by A.K.M. 1.3.5 *****
//		Implement zoom buttons
		tools = Box.createHorizontalBox();
		buttonGroup = new ButtonGroup();
		buttons = new Vector();

		JToggleButton no = new JToggleButton();
		buttonGroup.add(no);

		zoomInTB = zoomer.getZoomIn();
		zoomInTB.setActionCommand("Zoom In");
		zoomInTB.addActionListener(this);
		zoomInTB.setSelectedIcon( Icons.getIcon( Icons.ZOOM_IN, true ) );
		//buttons.add( zoomInTB );
		buttonGroup.add( zoomInTB );
		tools.add( zoomInTB );
		zoomInTB.setBorder( null );
		zoomInTB.setToolTipText("Ctrl-click");

		zoomOutTB = zoomer.getZoomOut();
		zoomOutTB.setActionCommand("Zoom Out");
		zoomOutTB.addActionListener(this);
		zoomOutTB.setSelectedIcon( Icons.getIcon( Icons.ZOOM_OUT, true ) );
		//buttons.add( zoomOutTB );
		buttonGroup.add( zoomOutTB );
		tools.add( zoomOutTB );
		zoomOutTB.setBorder( null );
		zoomOutTB.setToolTipText("Shift-Ctrl-click");

//		Add toggler so that zoom buttons can be deselected
		new ToggleToggler( zoomInTB, no );
		new ToggleToggler( zoomOutTB, no );
//		***** Changed by A.K.M. 1.3.5 *****

		addMouseListener(zoomer);
		addMouseMotionListener(zoomer);
		addKeyListener(zoomer);

		JButton b = new JButton(Icons.getIcon(Icons.SAVE,false));
		b.setPressedIcon( Icons.getIcon(Icons.SAVE,true) );
		b.setBorder(null);
		b.addActionListener(this);
		tools.add(b);
		b.setToolTipText("Save Image");
		b.setActionCommand("save");

		autoload = new JCheckBox("auto-load");
		autoload.setSelected( false );
		digDir = null;
		cruise = null;

		range = new int[] {-1, -1};
		height = 1334;
		width = 300;
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:78,代码来源:SCSImage2.java


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