本文整理了Java中javax.swing.JButton.setIcon()
方法的一些代码示例,展示了JButton.setIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setIcon()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setIcon
暂无
代码示例来源:origin: stackoverflow.com
JButton button = new JButton();
try {
Image img = ImageIO.read(getClass().getResource("resources/water.bmp"));
button.setIcon(new ImageIcon(img));
} catch (Exception ex) {
System.out.println(ex);
}
代码示例来源:origin: skylot/jadx
label.setIcon(node.getIcon());
final JButton button = new JButton();
button.setIcon(ICON_CLOSE_INACTIVE);
button.setRolloverIcon(ICON_CLOSE);
button.setRolloverEnabled(true);
代码示例来源:origin: log4j/log4j
JButton newButton = new JButton("Clear Log Table");
newButton.setIcon(newIcon);
代码示例来源:origin: stanfordnlp/CoreNLP
buttonsAndFilePanel = new javax.swing.JPanel();
loadButtonPanel = new javax.swing.JPanel();
loadFileButton = new javax.swing.JButton();
loadParserButton = new javax.swing.JButton();
saveOutputButton = new javax.swing.JButton();
buttonPanel = new javax.swing.JPanel();
backButton = new javax.swing.JButton();
if (getClass().getResource("/edu/stanford/nlp/parser/ui/leftarrow.gif") != null) {
backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/stanford/nlp/parser/ui/leftarrow.gif")));
} else {
backButton.setText("< Prev");
forwardButton = new javax.swing.JButton();
if (getClass().getResource("/edu/stanford/nlp/parser/ui/rightarrow.gif") != null) {
forwardButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edu/stanford/nlp/parser/ui/rightarrow.gif")));
} else {
forwardButton.setText("Next >");
代码示例来源:origin: kiegroup/optaplanner
private JButton createButton(Lecture lecture, Color color, String toolTip) {
JButton button = SwingUtils.makeSmallButton(new JButton(new LectureAction(lecture)));
button.setBackground(color);
if (lecture.isPinned()) {
button.setIcon(CommonIcons.PINNED_ICON);
}
button.setToolTipText(toolTip);
return button;
}
代码示例来源:origin: skylot/jadx
add(searchField);
JButton prevButton = new JButton(NLS.str("search.previous"));
prevButton.setIcon(ICON_UP);
prevButton.addActionListener(new ActionListener() {
@Override
add(prevButton);
JButton nextButton = new JButton(NLS.str("search.next"));
nextButton.setIcon(ICON_DOWN);
nextButton.addActionListener(new ActionListener() {
@Override
add(wholeWordCB);
JButton closeButton = new JButton();
closeButton.setIcon(ICON_CLOSE);
closeButton.addActionListener(l -> toggle());
closeButton.setBorderPainted(false);
代码示例来源:origin: kiegroup/optaplanner
private JButton createButton(TeamAssignment teamAssignment, Color color) {
JButton button = SwingUtils.makeSmallButton(new JButton(new TeamAssignmentAction(teamAssignment)));
button.setBackground(color);
if (teamAssignment.isPinned()) {
button.setIcon(CommonIcons.PINNED_ICON);
}
return button;
}
代码示例来源:origin: runelite/runelite
: navigationButton.getIcon();
final JButton button = new JButton();
button.setSize(scaledImage.getWidth(), scaledImage.getHeight());
button.setToolTipText(navigationButton.getTooltip());
button.setIcon(new ImageIcon(scaledImage));
button.putClientProperty(SubstanceSynapse.FLAT_LOOK, Boolean.TRUE);
button.setFocusable(false);
代码示例来源:origin: kiegroup/optaplanner
private JButton createButton(Match match, Team team, Team otherTeam, String toolTip) {
Color color = determinePlanningEntityColor(match, otherTeam);
String label = otherTeam.getLabel();
JButton button = SwingUtils.makeSmallButton(new JButton(new MatchAction(match, label)));
if (match.getAwayTeam() == team) {
button.setIcon(awayMatchIcon);
}
button.setBackground(color);
button.setToolTipText(toolTip);
return button;
}
代码示例来源:origin: RipMeApp/ripme
ripTextfield.addMouseListener(new ContextMenuMouseListener());
ImageIcon ripIcon = new ImageIcon(mainIcon);
ripButton = new JButton("<html><font size=\"5\"><b>Rip</b></font></html>", ripIcon);
stopButton = new JButton("<html><font size=\"5\"><b>Stop</b></font></html>");
stopButton.setEnabled(false);
try {
Image stopIcon = ImageIO.read(getClass().getClassLoader().getResource("stop.png"));
stopButton.setIcon(new ImageIcon(stopIcon));
} catch (Exception ignored) { }
JPanel ripPanel = new JPanel(new GridBagLayout());
openButton = new JButton();
openButton.setVisible(false);
JPanel statusPanel = new JPanel(new GridBagLayout());
Image icon;
icon = ImageIO.read(getClass().getClassLoader().getResource("comment.png"));
optionLog.setIcon(new ImageIcon(icon));
icon = ImageIO.read(getClass().getClassLoader().getResource("time.png"));
optionHistory.setIcon(new ImageIcon(icon));
icon = ImageIO.read(getClass().getClassLoader().getResource("list.png"));
optionQueue.setIcon(new ImageIcon(icon));
icon = ImageIO.read(getClass().getClassLoader().getResource("gear.png"));
optionConfiguration.setIcon(new ImageIcon(icon));
} catch (Exception e) { }
gbc.gridx = 0; optionsPanel.add(optionLog, gbc);
代码示例来源:origin: redwarp/9-Patch-Resizer
new JButton(String.format(Locale.getDefault(), Localization.get("xhdpi"),
Configuration.getSettings().getDefaultInputDensity().getName()));
this.xhdpiButton.addActionListener(new ActionListener() {
this.xhdpiButton.setHorizontalTextPosition(SwingConstants.CENTER);
this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);
this.xhdpiButton.setIcon(this.blueArrow);
this.xhdpiButton.setSelectedIcon(this.redArrow);
this.xhdpiButton.setBorder(null);
代码示例来源:origin: marytts/marytts
jLabel_VersionNum = new javax.swing.JLabel();
jLabel_DFKILogo = new javax.swing.JLabel();
jButton_OK = new javax.swing.JButton();
jLabel_ToolIcon = new javax.swing.JLabel();
jLabel_CopyrightDate = new javax.swing.JLabel();
jButton_OK.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/ok_16x16.png")));
jButton_OK.setText("OK");
jButton_OK.setPreferredSize(new java.awt.Dimension(95, 25));
代码示例来源:origin: marytts/marytts
jCheckBox_PlayBackRec = new javax.swing.JCheckBox();
jCheckBox_ContinueWithNext = new javax.swing.JCheckBox();
jButton_Record = new javax.swing.JButton();
jButton_Play = new javax.swing.JButton();
jSeparator_MessageBar = new javax.swing.JSeparator();
jLabel_MessageBar = new javax.swing.JLabel();
jCheckBox_PlayClosingBeep = new javax.swing.JCheckBox();
jLabel_MessageBarIcon = new javax.swing.JLabel();
jButton_Display = new javax.swing.JButton();
jMenuBar_AdminWindow = new javax.swing.JMenuBar();
jMenu_File = new javax.swing.JMenu();
jButton_Record.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/recording_16x16.png")));
jButton_Record.setText("Record");
jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/playing_16x16.png")));
jButton_Play.setText("Play");
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
代码示例来源:origin: marytts/marytts
jButton_SaveOptions = new javax.swing.JButton();
jButton_CancelOptions = new javax.swing.JButton();
jTabbedPane_Options = new javax.swing.JTabbedPane();
jPanel_AudioOptions = new javax.swing.JPanel();
jLabel_AudioMixer = new javax.swing.JLabel();
cbAudioSource = new javax.swing.JComboBox();
jButton_Record = new javax.swing.JButton();
jButton_Play = new javax.swing.JButton();
jProgressBar_Amplitude = new javax.swing.JProgressBar();
jButton_SaveOptions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/ok_16x16.png")));
jButton_SaveOptions.setText("Save");
jButton_SaveOptions.addActionListener(new java.awt.event.ActionListener() {
jButton_CancelOptions.setIcon(new javax.swing.ImageIcon(getClass()
.getResource("/marytts/tools/redstart/cancel_16x16.png")));
jButton_CancelOptions.setText("Cancel");
jButton_Record.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/recording_16x16.png")));
jButton_Record.setText("Record");
jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setIcon(new javax.swing.ImageIcon(getClass().getResource("/marytts/tools/redstart/playing_16x16.png")));
jButton_Play.setText("Play");
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
代码示例来源:origin: magefree/mage
private void setTypeIcon(BufferedImage bufferedImage, String toolTipText) {
iconPanel = new JPanel();
iconPanel.setLayout(null);
iconPanel.setOpaque(false);
add(iconPanel);
typeButton = new JButton("");
typeButton.setLocation(2, 2);
typeButton.setSize(25, 25);
iconPanel.setVisible(true);
typeButton.setIcon(new ImageIcon(bufferedImage));
if (toolTipText != null) {
typeButton.setToolTipText(toolTipText);
}
iconPanel.add(typeButton);
}
代码示例来源:origin: stackoverflow.com
JButton button = new JButton();
button.setBorderPainted(false);
button.setBorder(null);
//button.setFocusable(false);
button.setMargin(new Insets(0, 0, 0, 0));
button.setContentAreaFilled(false);
button.setIcon(myIcon1);
button.setRolloverIcon(myIcon2);
button.setPressedIcon(myIcon3);
button.setDisabledIcon(myIcon4);
代码示例来源:origin: haraldk/TwelveMonkeys
private static void addImage(final Container pParent, final ImageReader pReader, final int pImageNo) throws IOException {
final JButton button = new JButton();
button.setIcon(new ImageIcon(image) {
TexturePaint texture;
代码示例来源:origin: magefree/mage
setPanel.add(pack);
JButton searchButton = new JButton();
searchButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png")));
searchButton.setToolTipText("Search and select from list");
searchButton.setAlignmentX(1.0F);
代码示例来源:origin: magefree/mage
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
lblLandSet = new javax.swing.JLabel();
lblDeckSize = new javax.swing.JLabel();
spnDeckSize = new javax.swing.JSpinner();
btnAutoAdd = new javax.swing.JButton();
btnAdd = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
panelSet = new javax.swing.JPanel();
panelSet.add(cbLandSet);
btnSetFastSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png"))); // NOI18N
btnSetFastSearch.setToolTipText("Search for set");
btnSetFastSearch.setAlignmentX(1.0F);
代码示例来源:origin: magefree/mage
fillerGlobal1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 5), new java.awt.Dimension(0, 5), new java.awt.Dimension(32767, 5));
labelGlobal = new javax.swing.JLabel();
buttonStop = new javax.swing.JButton();
fillerglobal2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 5), new java.awt.Dimension(0, 5), new java.awt.Dimension(32767, 5));
tabsList = new javax.swing.JTabbedPane();
comboSets = new javax.swing.JComboBox<>();
fillerMode1 = new javax.swing.Box.Filler(new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 0), new java.awt.Dimension(5, 32767));
buttonSearchSet = new javax.swing.JButton();
panelRedownload = new javax.swing.JPanel();
checkboxRedownload = new javax.swing.JCheckBox();
tabCustom = new javax.swing.JPanel();
panelCommands = new javax.swing.JPanel();
buttonOK = new javax.swing.JButton();
buttonCancel = new javax.swing.JButton();
panelModeSelect.add(fillerMode1);
buttonSearchSet.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png"))); // NOI18N
buttonSearchSet.setToolTipText("Fast search your flag");
buttonSearchSet.setAlignmentX(1.0F);
内容来源于网络,如有侵权,请联系作者删除!