How to set Icon on MenuItem
How to set icon on MenuItem, but not in JMenuItem?
saleemtol003 wrote:
You are right.It's not possible to set icon on menuItem.
I am talking about SystemTray in which I added PopupMenu with MenuItem.
but I need MenuItem with icon.Is there another way to solve this problem?Nope, just because you're adding a PopupMenu to a TrayIcon does not change the fact that MenuItems cannot have icons.
Similar Messages
-
How to set icon image in jstudio for my application
Dear friends,
I developed one application in jstudio.And need to set an special icon for my application.While i download my application in to mobile. The icon should be displayed in the mobile.To show my application as unique from other applications.But i dont know how to set an icon for my application. If any one find answer please reply as soon as possible.
Thank youJava Studio Enterprise per se does not support creating applications for mobile devices. I gues you used NetBeans Mobility Pack for that. Therefore, please refer to http://mobility.netbeans.org/ for more information. Thanks.
Here is a FAQ entry, which, as far as I understand answers your question: http://www.netbeans.org/kb/faqs/j2me-mobility.html#FaqJ2MESpecifyMidletIcon -
How to set icon for .lnk on PPC
I'm using the Mysaifu JVM and I would like to know how to set an icon of my choice for the shortcut file to my application (.lnk). Currently, the Mysaifu character shows up as the icon.
On a previous post, I found out how to run my java application using the following text in my .lnk file:
255#"\Program Files\Mysaifu JVM\jre\bin\jvm.exe" -Xhidevmwindow -Xmx5M -jar "\My Documents\DeliveryOrganizer.jar" DeliveryOrganizer
Please help!!!
Your help would be much appreciated!
Thanks!I don't think you're going to have much luck modifying the original link, since the jvm.exe is what the link is pointing to. Windows Mobile is getting its icon from the jvm.exe, and not the DeliveryOrganizer jar file.
However, you might look into creating a separate .lnk file, that then calls your original .lnk file that executes the jvm.exe. See if Windows Mobile allows you to modify the new .lnk file's properties... -
How to Set icon/image programatically in ADF before page loads
This is my UI:
Depends on the condition i want to set icon/image programatically in my java code.Before page load im calling this method.
So i couldnt take binding value also,it throws null pointer exception.Then i tried setting icon/image programatically.
<af:commandImageLink text="settings" icon="#{bean.iconsettings}" binding="#{bean.bind}"> </af:commandImageLink>
My bean:
private RichIcon iconsettings;(its getters and setters)
private void method(){ // method
if(cond){
this.iconsettings="/images/20.jpg"; //trying to set icon in a string.but it throws me error that cannot set RichIcon to string.
else
this.iconsettings="/images/19.jpg";
Could any one tell me how can i set icon/image in java code.Before page loads im performing all above said tasks.Please help.Well, you set the icon property to a bean method, which you have done. The bean method however need to have the signature
public String getIconsetting()
// your code returning hte path to the icon
if(cond){
return ="/images/20.jpg"; //trying to set icon in a string.but it throws me error that cannot set RichIcon to string.
else {
return ="/images/19.jpg";
The bindproperty is not needed, remove it and remove the RichIcon Iconsettings too´as it's not needed to and is the wrong type anyway.
Timo -
I wanted to set an icon image along with a label in MenuItem(AWT). I am not using swing component (JMenuItem). Could any one advice me how to do this.
Thanks in advance.As far as I know you can't set an icon in a MenuItem object. MenuItem extends MenuComponent, which extends Object. None of which have a paint or paintComponent method which you can modify. Maybe you can extend MenuItem and create a class with a paintComponent method?
Sorry -
How to set icon in JavaHelp frame?
Hello everybody
I'm using JavaHelp 2.0 for the first time and I have been told that it is possible to set the icon within the JavaHelp frame. Furthermore it should be possible to set the position of the help window.
I used the following code within my Java class to start JavaHelp, as the help frame should appear, when the user clicks on "JavaHelp" within the "Help" menu:
JMenu helpMenu = new JMenu("Help");
try {
URL hsURL = new File("javahelp/DbManager.hs").toURL();
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker();
menuItem = new JMenuItem("JavaHelp");
menuItem.addActionListener(new CSH.DisplayHelpFromSource(hb));
helpMenu.add(menuItem);
} catch (Exception e) {
}My helpset is called "DbManager.hs" and here's the presentation section of it (of course the image "dbmanager.title.image" is defined within the map file):
<!-- presentation -->
<presentation default="true" displayviews="true" displayviewimages="false">
<name>MainWindow</name>
<size width="600" height="500" />
<location x="200" y="200" />
<title>Database Manager</title>
<image>dbmanager.title.image</image>
</presentation>When I start the JavaHelp it does not show the Icon and it does not set the size and location accordingly.
I'd be very glad for any hint on what I might be overlooking.
Thanks,
ChristianHi,
You need to specify the name of your presentation in the createHelpBroker call:
JMenu helpMenu = new JMenu("Help");
try {
URL hsURL = new File("javahelp/DbManager.hs").toURL();
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker("MainWindow");
menuItem = new JMenuItem("JavaHelp");Then it should work.
Brendan -
In JFrame there is method setIconImage(Image) for setting image icon on title bar , but in case of JDialog how to it?
In case you have not mentioned the owner of JDialog, java sets a hidden frame as its owner.Thefore you can set the icon on a JDialog dialog by
((java.awt.Frame)dialog.getOwner()).setIconImage(Image);
Regards
Shashi -
hi,
I have a JTree. For this JTree i have a DefaultJTreeCellRenderer.
i have done like this
JTree tree = new JTree();
DefaultJTreeCellRenderer renderer = new DefaultJTreeCellRenderer();
renderer.setOpenIcon(....);
renderer.serCloseIcon(...);
tree.setCellRenderer(renderer);but this is not working.
how to change the icons of the node when i click
thank youpublic class Test extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private JButton buttonCreate;
private JTree tree;
private DefaultMutableTreeNode defaultMutableTreeNode;
private DefaultTreeModel defaultTreeModel;
private int i;
public Test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
layoutComponents();
setSize(400, 400);
setLocationRelativeTo(null);
setVisible(true);
private void layoutComponents() {
defaultMutableTreeNode = new DefaultMutableTreeNode("Root");
defaultTreeModel = new DefaultTreeModel(defaultMutableTreeNode);
tree = new JTree(defaultTreeModel);
tree.setRootVisible(false);
buttonCreate = new JButton("Create");
getContentPane().setLayout(new BorderLayout());
getContentPane().add(tree, BorderLayout.CENTER);
getContentPane().add(buttonCreate, BorderLayout.SOUTH);
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
ImageIcon icon_close = new ImageIcon("./images/project_closed.gif");
ImageIcon icon_open = new ImageIcon("./images/project_opened.gif");
renderer.setOpenIcon(icon_open);
renderer.setClosedIcon(icon_close);
tree.setCellRenderer(renderer);
buttonCreate.addActionListener(this);
public static void main(String[] args) {
new Test();
public void actionPerformed(ActionEvent e) {
addElementToParent("Child" + i++);
private DefaultMutableTreeNode addElementToParent(Object theChild) {
return addElementToParent(defaultMutableTreeNode, theChild, true);
private DefaultMutableTreeNode addElementToParent(DefaultMutableTreeNode theParent, Object theChild, boolean shouldBeVisible) {
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(theChild);
if (theParent == null) {
theParent = defaultMutableTreeNode;
defaultTreeModel.insertNodeInto(childNode, theParent, theParent.getChildCount());
TreePath childTreePath = new TreePath(childNode.getPath());
// Make sure the user can see the lovely new node.
if (shouldBeVisible) {
tree.scrollPathToVisible(childTreePath);
tree.requestFocusInWindow();
return childNode;
}this is the code which i was trying to execute.
here i want to explain you is
when i click the node the icon should change to open_icon
when i click the other node the previous node icon should change to close_icon
how is this possible
null -
How to set icon to a file type??
How to assign an icon to the application generated file?
Thanks in advance.What GUI do you work with?
I assume you want to see the icons in Windows. You will have to modify the registry, possibly by some native API call. Have a look at the MSDN library then.
Hiran -
How to set icon that fit(stretch) to JLabel?
Let say i have aa image(w = 50, h = 50) and JLabel(w = 100, h = 100)
how to fit the image to JLabel by JLabel.setIcon(image)?
thx..Ooop... sorry u mean getScaledInstance right, by the way which the faster way to scale image? code 1 or code 2
Code 1.
public ImageIcon create_Thumbnail(ImageIcon img,int w , int h ){
img = new ImageIcon(img.getImage().getScaledInstance(w, h, BufferedImage.SCALE_SMOOTH));
return img;
}Code 2
public ImageIcon create_Thumbnail(ImageIcon img,int w , int h ){
BufferedImage bi;
bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(img.getImage(), 0, 0, w, h, null);
g2.dispose();
return new ImageIcon(bi);
} -
How to set transactionManager on XADataSource?
How do I set the transaction manager on an OracleXADataSource?
Other data source implementations that I've used (such as XAPool) have a setTransactionManager method that allows one to programmatically assign the transaction manager, but there is no similar method on the OracleXADataSource.
I need to do XA transactions on an Oracle database from outside an application server (not using JNDI). I am having trouble getting transactions to occur correctly, and believe it is because the OracleXADataSource doesn't know anything about my standalone transaction manager (jotm).
How can I set the transaction manager on the data source?
thanks for any information...saleemtol003 wrote:
You are right.It's not possible to set icon on menuItem.
I am talking about SystemTray in which I added PopupMenu with MenuItem.
but I need MenuItem with icon.Is there another way to solve this problem?Nope, just because you're adding a PopupMenu to a TrayIcon does not change the fact that MenuItems cannot have icons. -
"I would like to know how to set the default view for the columns that are shown in iTunes. Every time I open it, I have to either go to the options, or right-click to get the pop-up options, and delete "rating" and add "composer." I'd really like to just do it once and be done with it." Somewhere I read you could do this by clicking on the Music icon under LIBRARY then arramge the columns. Trouble is, I can't find a Musi Folder or icon in my user library.
Any help would be appreiated. OSX 10.9.2 iTunes version 11.1.5 Thanks!!! CW!From the iTunes menu bar try View>Show View Options. Make sure what you want to see is checked and what you don't is unchecked. You can do this (may need to do this) for any playlists, your main Library, etc.
Good luck
srb -
How can we set icon to a tree table
Hi ADF Experts,
The below is regarding skinning of af:tree table component.
How can we set icon to a tree table
Below is the af:tree component. When I run the application I see all the parent and child nodes as folder icon. My question is how can set a file icon to the elements present inside a parent node.
<af:treeTable value="#{pageFlowScope.MerchandizeTreeModel.productTreeModel}"
id="tt1" var="row"
rowSelection="multiple"
horizontalGridVisible="false"
verticalGridVisible="false">
<f:facet name="nodeStamp">
<af:column sortable="false" headerText=""
rowHeader="true" id="c11" width="200">
<af:panelGroupLayout id="pgl0">
<af:image source="/images/folder.png" shortDesc="foldericon"
id="i1"/>
<af:outputText value="#{row.groceryItems}" id="ot11"/>
</af:panelGroupLayout>
</af:column>
</f:facet>
</af:treeTable>
Thanks in advance,
AnimeshHi Experts,
I am having a tree table component in adf. I have set a folder image for the parent node. How can we set a document image for contents inside a parent node.
Thanks,
Biswa -
How to set forms 11g buttons to display icons
Hi,
How to set forms 11g buttons to display icons.Actually i have tried so many links
http://blog.newtrics.com/?p=936
Re: Icon image not showing in forms 11g RELEASE 2
but i am not getting image on the Oracle Form.Bad Image is always showing.
I am trying from 1 week So plz help me Its very urgent .
Thanks
Anup
Edited by: 888679 on May 22, 2012 4:37 AMam afraid u r configuring the wrong file path pls verify....
formsweb.cfg
path = c:\Oracle\Middleware\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\conf
registry entries as well
Hope this helps...
Regards,
Amatu Allah
Edited by: Amatu Allah on May 22, 2012 6:17 AM -
How to set different Icons for Jtreenode
How to set different Icons for Jtreenode,i want to set icons for jtreenode,not only for leaf,open,closeicon,i hope that each node has a different icon.Thanks!
you need to check for the node value within a renderer, then assign an icon based on what you expect to get back.
check out this page. http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
Maybe you are looking for
-
Showing multiple values on front panel using array
For example, if I input "10" for number of datapoints, I want to see 10 hex and binary values all listed in a column. Right now, only 1 value shows up and all the previous values get erased Thanks! Solved! Go to Solution. Attachments: labviewa.png 3
-
Hi All, I am using DC components for my projects.Recently I have encountered problems with my DC components. The "DCMetaData" in WebDynpro perspective is no longer getting reflected. Steps:- Open WebDynpro perspective -->WebDynpro Explorer --> Expand
-
LR and SSD, which cache to choose?
Hi all, I've just bought an SSD as primary bood disc under Windows and, as I have minimized the space taken by the OS, I get around 150GB free for my applications. As LR is quite slow in loading and showing raw files especially in Develop module, I'v
-
CO: IO automatic Creation of settlement rule
Hello everyone, We created a customer field in internal order (ZWBS field). Now, I customized all transactions: 1. By T-code KSR4 I created Strategy 'C25'. 2. I created Strategy Seq. called 'ZC25' by T-Code 'KSR2_ORC'. 3. I' have Assigned the strateg
-
Hello all After i added new cube to a multiprovider, i have tried to activate one of thr aggregation levels, and i get this error: " Aggregation level ZIP_QTR2: InfoProvider ZBCSINCGE cannot be used for definition Aggregation level ZIP_QTR2 is incons