本文整理了Java中javax.swing.JFrame.setIconImage()
方法的一些代码示例,展示了JFrame.setIconImage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.setIconImage()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:setIconImage
暂无
代码示例来源:origin: kiegroup/optaplanner
return;
final JFrame exceptionFrame = new JFrame("Uncaught exception: " + e.getMessage());
Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon");
BufferedImage errorImage = new BufferedImage(
errorIcon.getIconWidth(), errorIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
errorIcon.paintIcon(null, errorImage.getGraphics(), 0, 0);
exceptionFrame.setIconImage(errorImage);
exceptionFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JPanel contentPanel = new JPanel(new BorderLayout(5, 5));
代码示例来源:origin: log4j/log4j
_logMonitorFrame = new JFrame("LogFactor5");
_logMonitorFrame.setIconImage(new ImageIcon(lf5IconURL).getImage());
代码示例来源:origin: stackoverflow.com
// Create frame
String title = "Frame Title";
JFrame frame = new JFrame(title);
// Set icon
Image icon = Toolkit.getDefaultToolkit().getImage("icon.gif");
frame.setIconImage(icon);
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("Title");
frame.setIconImage(frameImage);
代码示例来源:origin: stackoverflow.com
JFrame f = new JFrame("Edit Configure File");
//Image image = ImageIO.read(getClass().getResource("images/ctx.Icon"));
f.setIconImage(new ImageIcon("images/ctx.PNG").getImage());//this works for me finally
//f.setIconImage(image);
//f.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("images/ctx.PNG")));
代码示例来源:origin: stackoverflow.com
BufferedImage image = ImageIO.read(new URL(
"http://www.gravatar.com/avatar/f1d58f7932b6ae8027c4e1d84f440ffe?s=128&d=identicon&r=PG"));
JFrame frame = new JFrame();
frame.setIconImage(image);
JOptionPane.showInputDialog(frame, "Enter Address", "Chat",
JOptionPane.QUESTION_MESSAGE, null, null, "");
代码示例来源:origin: stackoverflow.com
JFrame.setDefaultLookAndFeelDecorated(true);
//Create the frame.
JFrame frame = new JFrame("A window");
//Set the frame icon to an image loaded from a file.
frame.setIconImage(new ImageIcon(imgURL).getImage());
代码示例来源:origin: stackoverflow.com
JFrame newFrame = new JFrame("PhotoAlbum");
ImageIcon img = new ImageIcon("Photos/albumIcon.png");
newFrame.setIconImage(img.getImage());
代码示例来源:origin: stackoverflow.com
public Test {
public static void main(String[] args) {
JFrame frame = new JFrame("My Frame");
frame.setIconImage(new ImageIcon(Test.class.getResource("image.png"));
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.setVisible(true);
frame.setSize(100, 100);
//other stuffs....
}
}
代码示例来源:origin: stackoverflow.com
private void launchEventPanel(final String title) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame myFrame = new JFrame();
myFrame.setTitle("Conference Call");
myFrame.setIconImage(CallConference.this.myCore.myPanel.myIconManager.getPromptIcon(CallEMart.class.toString()));
myFrame.getContentPane().add(CallConference.this.myEventPanel, "Center");
myFrame.pack();
myFrame.setVisible(true); } }); }
代码示例来源:origin: stackoverflow.com
private void launchEventPanel(final String title) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame myFrame = new JFrame();
myFrame.setTitle(title);
myFrame.setIconImage(CrConference.this.mainCore.myPanel.myIconManager.getPromptIcon(Mart.class.toString()));
myFrame.getContentPane().add(Conference.this.myEventPanel, "Center");
myFrame.pack();
myFrame.setVisible(true);
}
});
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setIconImage(ImageIO.read(new File(PATH)));
frame.setBounds(100, 100, 400, 400);
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
private void launchEventPanel(final String title) {
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame myFrame = new JFrame();
myFrame.setTitle("Conference Call");
myFrame.setIconImage(CallConference.this.myCore.myPanel.myIconManager.getPromptIcon(CallEMart.class.toString()));
myFrame.getContentPane().add(CallConference.this.myEventPanel, "Center");
myFrame.pack();
myFrame.setVisible(true); } }); }
代码示例来源:origin: klevis/AutonomousDriving
private JFrame createMainFrame() {
JFrame mainFrame = new JFrame();
mainFrame.setTitle("Autonomous Driving");
mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
mainFrame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
mainFrame.setLocationRelativeTo(null);
mainFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
ImageIcon imageIcon = new ImageIcon("icon.png");
mainFrame.setIconImage(imageIcon.getImage());
return mainFrame;
}
代码示例来源:origin: stackoverflow.com
public CharacterCreator() {
super();
JFrame application = new JFrame();
application.setTitle("Window");
application.setBackground(Color.WHITE);
application.setIconImage(null);
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
application.setSize(500, 400);
application.setLocationRelativeTo(null);
application.setVisible(true);
CharacterCreator panel = CharacterCreator();
application.add(panel);
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame("ORDERING FOOD APPLICATION");
JPanel panel = new JPanel();
ImageIcon icon = new ImageIcon("hamburger.jpg");
frame.setIconImage(icon.getImage());
try {
frame.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("fd12.jpg")))));
} catch (IOException e) {
e.printStackTrace();
}
frame.setLayout(new GridBagLayout());
JButton btn = new JButton("Click me");
frame.add(btn);
frame.pack();
frame.setVisible(true);
代码示例来源:origin: org.junit/com.springsource.junit
protected JFrame createFrame() {
JFrame frame= new JFrame("JUnit");
Image icon= loadFrameIcon();
if (icon != null)
frame.setIconImage(icon);
frame.getContentPane().setLayout(new BorderLayout(0, 0));
frame.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
terminate();
}
}
);
return frame;
}
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
public static JFrame createNewWindow(Canvas canvas, String title, int width, int height)
{
JPanel panel = new JPanel(new BorderLayout());
panel.add("Center", canvas);
panel.setPreferredSize(new Dimension(width, height));
JFrame jFrame = new JFrame(title);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = jFrame.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add("Center", panel);
jFrame.setIconImage(new ImageIcon("resources/running-man-32x32.png").getImage());
jFrame.pack();
jFrame.setVisible(true);
jFrame.setLocationRelativeTo(null);
return jFrame;
}
}
代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit
public static JFrame createNewWindow(Canvas canvas, String title, int width, int height)
{
JPanel panel = new JPanel(new BorderLayout());
panel.add("Center", canvas);
panel.setPreferredSize(new Dimension(width, height));
JFrame jFrame = new JFrame(title);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = jFrame.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add("Center", panel);
jFrame.setIconImage(new ImageIcon("resources/running-man-32x32.png").getImage());
jFrame.pack();
jFrame.setVisible(true);
jFrame.setLocationRelativeTo(null);
return jFrame;
}
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public BambooVideoWall()
{
jFrame = new JFrame(BambooVideoWall.class.getSimpleName());
double adjustedVideoHeight = PLAYBACKER_HEIGHT / (double) NUMBER_OF_ROWS_OF_VIDEO;
double adjustedVideoWidth = adjustedVideoHeight * VIDEO_WIDTH / VIDEO_HEIGHT;
double width = adjustedVideoWidth * NUMBER_OF_COLUMNS_OF_VIDEO;
videoPlayerGrid = new VideoPlayerGrid(NUMBER_OF_ROWS_OF_VIDEO, NUMBER_OF_COLUMNS_OF_VIDEO);
jFrame.getContentPane().add(videoPlayerGrid);
jFrame.setSize((int) width, (int) PLAYBACKER_HEIGHT + jFrame.getInsets().top);
jFrame.setIconImage(new ImageIcon(ClassLoader.getSystemResource("us/ihmc/tools/icons/running-man-32x32.png").getPath()).getImage());
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setVisible(true);
}
内容来源于网络,如有侵权,请联系作者删除!