本文整理匯總了Java中javax.swing.JFrame.setIconImage方法的典型用法代碼示例。如果您正苦於以下問題:Java JFrame.setIconImage方法的具體用法?Java JFrame.setIconImage怎麽用?Java JFrame.setIconImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setIconImage方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setIcon
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void setIcon(JFrame frame, String icon) {
try {
frame.setIconImage(ImageIO.read(JUtils.class.getResourceAsStream(icon)));
} catch (IOException ex) {
StaticStandard.logErr(ex, false);
}
}
示例2: topComponentIconChanged
import javax.swing.JFrame; //導入方法依賴的package包/類
protected void topComponentIconChanged(TopComponent tc, Image icon) {
JFrame f = (JFrame) SwingUtilities.getAncestorOfClass(JFrame.class, tc);
if (f != null) {
f.setIconImage(icon);
}
}
示例3: setFor
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void setFor(JFrame w) {
if (icons == null) return;
if (setIconImages != null) {
setIconImages(w);
}
else {
// Load a single image as a fallback and watch in horror as it
// gets scaled to ridiculous sizes.
w.setIconImage(icons.get(0));
}
}
示例4: init
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
*
* @Title: init
* @Description: Component Initialization
* @param
* @return void
* @throws
*/
private static void init()
{
MenuBarView mbv = new MenuBarView();
JFrame frame = new JFrame(FormatConst.FORMAT_VERSION);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setJMenuBar(mbv.getJMenuBar());
frame.getContentPane().add(FormatView.getView());
frame.pack();
frame.setVisible(true);
frame.setIconImage(FormatUtil.getImage(FormatConst.LOGO));
FormatUtil.setLocation(frame);
}
示例5: AppWindow
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Create the main window.
*/
public AppWindow() {
frmElectrolightIntrusionDetection = new JFrame();
frmElectrolightIntrusionDetection.setIconImage(Toolkit.getDefaultToolkit().getImage(AppWindow.class.getResource("/javax/swing/plaf/metal/icons/ocean/menu.gif")));
frmElectrolightIntrusionDetection.setTitle("ElectroLight Intrusion Detection");
frmElectrolightIntrusionDetection.setBounds(100, 100, 450, 300);
frmElectrolightIntrusionDetection.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
frmElectrolightIntrusionDetection.getContentPane().add(tabbedPane, BorderLayout.CENTER);
ScannersGUI scannersGUI = new ScannersGUI();
tabbedPane.addTab("Scanners", null, scannersGUI, null);
}
示例6: main
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String[] args) {
//新建窗體對象
frame = new JFrame("2048");
frame.setIconImage(new ImageIcon(MainPanel.class.getResource("gameicon.png")).getImage());
//窗體大小
frame.setSize(460, 680);
//窗體居中
frame.setLocationRelativeTo(null);
//窗體大小不可變
frame.setResizable(false);
//默認的關閉操作
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//新建主麵板 對象
mainPanel = new MainPanel(frame);
//去掉麵板默認布局
mainPanel.setLayout(new FlowLayout(1, 200, 90));
//麵板背景顏色
mainPanel.setBackground(new Color(247, 239, 230));
//把麵板添加到窗體中
frame.add(mainPanel);
//窗體可見
frame.setVisible(true);
//主界麵的控製方法
mainPanel.run();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
try {
mainPanel.getClassicPanel().saveScore();
mainPanel.getClassicPanel().saveState();
mainPanel.getDropPanel().updateTopScore();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}
示例7: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setIconImage(Toolkit.getDefaultToolkit().getImage("E:\\圖片\\u=1829416607,2140971604&fm=21&gp=0.jpg"));
frame.setType(Type.UTILITY);
frame.setTitle("網絡電影評論情感傾向性分類");
frame.setBounds(100, 100, 639, 412);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("數據集自動標注");
menuBar.add(mnNewMenu);
JMenuItem mntmNewMenuItem_2 = new JMenuItem("自動標注");
mnNewMenu.add(mntmNewMenuItem_2);
JMenu mnNewMenu_1 = new JMenu("情感分析");
menuBar.add(mnNewMenu_1);
JMenuItem mntmNewMenuItem_3 = new JMenuItem("樸素貝葉斯算法");
mnNewMenu_1.add(mntmNewMenuItem_3);
JMenuItem mntmNewMenuItem_4 = new JMenuItem("N-Gram算法");
mnNewMenu_1.add(mntmNewMenuItem_4);
JMenuItem mntmNewMenuItem_5 = new JMenuItem("支持向量機");
mnNewMenu_1.add(mntmNewMenuItem_5);
JMenu mnNewMenu_2 = new JMenu("關於");
menuBar.add(mnNewMenu_2);
JMenuItem mntmNewMenuItem = new JMenuItem("作者");
mnNewMenu_2.add(mntmNewMenuItem);
JMenuItem mntmNewMenuItem_1 = new JMenuItem("New menu item");
mnNewMenu_2.add(mntmNewMenuItem_1);
}
示例8: main
import javax.swing.JFrame; //導入方法依賴的package包/類
public static void main(String[] args) {
logger.info("main start");
Init.initTheme();
Init.initGlobalFont(); //統一設置字體
frame = new JFrame(ConstantsUI.APP_NAME);
frame.setIconImage(ConstantsUI.IMAGE_ICON);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //得到屏幕的尺寸
frame.setBounds((int) (screenSize.width * 0.1), (int) (screenSize.height * 0.08), (int) (screenSize.width * 0.8),
(int) (screenSize.height * 0.8));
Dimension preferSize = new Dimension((int) (screenSize.width * 0.8),
(int) (screenSize.height * 0.8));
frame.setPreferredSize(preferSize);
mainWindow = new MainWindow();
frame.setContentPane(mainWindow.mainPanel);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.pack();
frame.setVisible(true);
Init.initOthers();
Init.initAllTab();
// 添加事件監聽
AboutListener.addListeners();
SettingListener.addListeners();
MsgListener.addListeners();
MemberListener.addListeners();
PushListener.addListeners();
ScheduleListener.addListeners();
TabListener.addListeners();
FramListener.addListeners();
}
示例9: initialize
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Initializes the GUI.
*/
private void initialize(){
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
// error window
windowError = new JFrame();
windowError.setBounds(100, 100, 300, 145);
windowError.setLocation(dim.width/2-windowError.getSize().width/2, dim.height/2-windowError.getSize().height/2);
windowError.setResizable(false);
windowError.setTitle("Ladder Tracker v" + version);
windowError.setIconImage(new ImageIcon(getClass().getResource("icon.png")).getImage());
windowError.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
windowError.getContentPane().setLayout(null);
// button retry
buttonRetry = new JButton("Retry");
buttonRetry.setBounds(10, 80, 274, 23);
buttonRetry.addActionListener(buttonRetryListener);
windowError.getContentPane().add(buttonRetry);
// error text
JTextPane textError = new JTextPane();
textError.setText(errorMessage);
textError.setEditable(false);
textError.setBackground(SystemColor.menu);
textError.setBounds(10, 21, 274, 39);
windowError.getContentPane().add(textError);
}
示例10: showOptions
import javax.swing.JFrame; //導入方法依賴的package包/類
private void showOptions() {
JFrame jf = new JFrame("Defaults Editor");
jf.setIconImage(getIconImage());
jf.setSize(getSize());
new DefaultsEditor(jf, DefaultsEditor.JSIM).show();
}
示例11: view
import javax.swing.JFrame; //導入方法依賴的package包/類
/**
* Constructs and views {@link JFrame} with a given title and a list of {@link ReliabilityFunction}s.
*
* @param title
* the title
* @param reliabilityFunctions
* the reliabilityFunctions
*/
public static void view(String title, Map<String, ReliabilityFunction> reliabilityFunctions) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
// Setup the aspects for the plot panel
List<Aspect> aspects = new ArrayList<>();
aspects.add(new ReliabilityFunctionAspect());
aspects.add(new DistributionAspect());
aspects.add(new DensityAspect());
aspects.add(new FailureRateAspect());
ReliabilityFunctionPlotPanel reliabilityFunctionPlotPanel = new ReliabilityFunctionPlotPanel(aspects);
JPanel plotPanel = reliabilityFunctionPlotPanel.get(reliabilityFunctions);
JPanel measuresPanel = new MeasuresPanel(reliabilityFunctions);
JFrame frame = new JFrame();
frame.setTitle(title);
frame.setIconImage(getImageIcon().getImage());
frame.setPreferredSize(new Dimension(1000, 500));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = frame.getContentPane();
frame.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.ipady = 10;
c.ipadx = 10;
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = 5;
c.weighty = 0.5;
content.add(measuresPanel, c);
c.gridx = 1;
c.gridy = 5;
c.weightx = 1.0;
c.weighty = 0.5;
content.add(plotPanel, c);
c.gridx = 0;
c.gridy = 20;
c.gridwidth = 2;
c.weighty = 0.0;
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.PAGE_END;
content.add(new JLabel(" \u00A9 JReliability.org 2008-2017"), c);
frame.pack();
frame.setVisible(true);
}
示例12: createSolutionWindow
import javax.swing.JFrame; //導入方法依賴的package包/類
private void createSolutionWindow() {
JTabbedPane jtp = new JTabbedPane();
JFrame solutionWindow = new JFrame("jMVA Solutions");
solutionWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
solutionWindow.getContentPane().add(jtp);
solutionWindow.setIconImage(this.getIconImage());
IterationSelector selector = null;
if (data.isWhatIf()) {
// Graphic panel (Bertoli Marco)
jtp.add(new GraphPanel(data));
selector = new IterationSelector(data);
}
ThroughputPanel throughput = new ThroughputPanel(this);
QueueLenPanel queuelength = new QueueLenPanel(this);
ResTimePanel restimes = new ResTimePanel(this);
UtilizationPanel utilizations = new UtilizationPanel(this);
//Added by ASHANKA START
//Introducing the new System Power Panel as a Tabbed Pane
SysPowerPanel systemPower = new SysPowerPanel(this);
//Added by ASHANKA STOP
if (selector != null) {
selector.addSolutionPanel(throughput);
selector.addSolutionPanel(queuelength);
selector.addSolutionPanel(restimes);
selector.addSolutionPanel(utilizations);
//Added by ASHANKA START
// for System Power
selector.addSolutionPanel(systemPower);
//Added by ASHANKA STOP
jtp.add(selector);
} else {
jtp.add(throughput);
jtp.add(queuelength);
jtp.add(restimes);
jtp.add(utilizations);
//Added by ASHANKA START
//for System Power
jtp.add(systemPower);
//Added by ASHANKA STOP
}
//NEW Dall'Orso 5-5-2005
SynopsisPanel synPane;
if (tempFile != null) {
synPane = new SynopsisPanel(this, tempFile);
} else {
synPane = new SynopsisPanel(this);
}
jtp.add(synPane);
//END
//BoundingBox of main window
Rectangle rect = this.getBounds();
solutionWindow.setBounds(rect.x + 20, rect.y + 20, rect.width, rect.height);
solutionWindow.show();
}