本文整理汇总了Java中javax.swing.JButton.setRolloverIcon方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setRolloverIcon方法的具体用法?Java JButton.setRolloverIcon怎么用?Java JButton.setRolloverIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setRolloverIcon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: createCloseButton
import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createCloseButton() {
JButton res = CloseButtonFactory.createBigCloseButton();
res.setModel( new DefaultButtonModel() {
@Override
public boolean isRollover() {
return inCloseButtonRect;
}
});
//allow third party look and feels to provide their own icons
Icon defaultIcon = UIManager.getIcon( "nb.popupswitcher.closebutton.defaultIcon" ); //NOI18N
if( null != defaultIcon )
res.setIcon( defaultIcon );
Icon rolloverIcon = UIManager.getIcon( "nb.popupswitcher.closebutton.rolloverIcon" ); //NOI18N
if( null != rolloverIcon )
res.setRolloverIcon( rolloverIcon );
return res;
}
示例3: ButtonFrame
import javax.swing.JButton; //导入方法依赖的package包/类
public ButtonFrame()
{
super("Testing Buttons");
setLayout(new FlowLayout());
plainJButton = new JButton("Plain Button"); // button with text
add(plainJButton); // add plainJButton to JFrame
Icon bug1 = new ImageIcon(getClass().getResource("bug1.gif"));
Icon bug2 = new ImageIcon(getClass().getResource("bug2.gif"));
fancyJButton = new JButton("Fancy Button", bug1); // set image
fancyJButton.setRolloverIcon(bug2); // set rollover image
add(fancyJButton); // add fancyJButton to JFrame
// create new ButtonHandler for button event handling
ButtonHandler handler = new ButtonHandler();
fancyJButton.addActionListener(handler);
plainJButton.addActionListener(handler);
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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);
}
});
}
示例8: 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);
}
});
}