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,
Christian

Hi,
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

Similar Messages

  • 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.

  • 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 you

    Java 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

  • How to set icon in JDialog

    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

  • Set Icon in the Frames

    Hi,
    I would like set a Icon (Icon.gif) in the frames that not be the default setting of the cup of coffee that set the Java in the top-left corner of window.
    It's this possible? and if so, how can I do it.
    Thanks in advance!!
    Salvador Huertas.

    You set the icon (probably in the Frame constructor) with :
    setIconImage(Toolkit.getDefaultToolkit().getImage("myIcon.gif"));
    To get the image from a Jar instead, do :
    setIconImage
    (Toolkit.getDefaultToolkit()
    .getImage(getClass().
    getResource("images/myIcon.gif")));

  • How to set Value from 1 frame to another ?

    I am having 2 Frame. Frame A and Frame B. Frame A is having a text Field and a button. When i click on the button on the Frame A, how can p*** the value inside the text field of Frame A into a text Field of Frame B which already prepared. Please help !

    Hi,
    Use a hidden field and assign the value to this field rather than a variable so that the value could be retained on the page submission and in the AM assign the value to the DB where ever you need it and ignore the value from the actual field, Hope it helps!
    Regards,
    Yuvaraj

  • How to set icon for JTree

    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 you

    public 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 textfield.text on frame after goto

    This seems a little ridiculous to be asking this question coz
    it seems like it should be so simple but here goes anyway.
    STEPS TO RECREATE:
    Step 1 - create a class called simpleButt(see attached)
    Step 2 - create a MovieClip with two frame labels on
    different keyframes- ROLLOVER and ROLLOUT. on these different
    keyframes place a dynamic textfield with instance name -
    'buttonTitle'. give it different styling attributes on the ROLLOVER
    frame such as text colour, bold or even a glow filter.
    Step 3 - In the movie clip's linkage properties, give it the
    'simpleButt' class.
    Step 4 - With nothing on the stage, add the following two
    lines to frame actions:
    var newButt:simpleButt=new simpleButt("hello");
    this.addChild(newButt);
    Step 5 - compile!
    this should add a simple button to the stage and set the
    button's textfield's text property.
    However, after going to another frame on rollover, we lose
    the dynamic text - i assume because we have another instance of the
    textfield on a different keyframe because it has new styling
    properties on rollover. but if i try to set the text after going to
    the new frame, it doesn't seem to recognise the textfield yet.
    (uncomment lines in simpleButt to see what i mean)
    through trial and error i've found that if i wait two
    ENTERFRAMEs, the textfield object becomes available, but by this
    time the textfield flickers. is there an event i'm missing or
    function i could override where i could set the properties of an
    object on a frame after a gotoAndStop before it is rendered?
    cheers
    Craig

    STEP 2(where the textfield was created) is all done manually
    within the authoring environment - no actionscript. This is usually
    done by the design team here so to save time i'm trying to avoid
    replicating every style change they've made in code.

  • 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 my own icon for java frame ??

    I create a java class it extends JFrame. I want to change default icon on the left_top corner and using my own icon. It is a --.gif file. How to do it. When I try to modify it using setIconImage( Image image), I met problem. I cann't new Image("--.gif"). I don't know how to create a Image object using a string(file name). I try to use ImageIcon , but it is not image obj. Thanks. Gary

    According to the documentation setIconImage does the following: Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.
    So,
    1) It does not change the icon in the top-left corner
    2) It does not work on all platforms.

  • How to set the icon for the entire application with JFrame.setIconImage

    I set the icon on the main frame using JFrame.setIconImage(). The icon is shown properly in the main frame.
    If more JFrames are opened from the main frame, the newly opened JFrames also show the icon.
    However if JDialogs are opended, in some cases the icon set on the main frame is shown and in other cases the coffee cup.
    What is JFrame.setIconImage() expected to do? Setting the icon for a single JFrame or the entire application?
    How can I set the icon for the entire application?
    How can I set the icon for JDialogs?
    Thank you

    In order for your dialogs to use the same icon as the frame, you must parent the dialogs to the frame which has the custom icon.
    See the following thread for more information: http://forum.java.sun.com/thread.jsp?forum=57&thread=362542
    cheers,
    Greg

  • CheckBox - how to set custom icons

    I need to figure out how to set a custom icon for a selected checkbox via the UIManager
    This works for un-selected checkboxes:
    UIManager.put("CheckBox.icon", new ImageIcon("../images/unselectedCheckBoxIcon.png")));
    how to change the icon when it is selected?
    I don't know the UIManager property for a selected checkbox icon and using the setSelectedIcon on the checkbox object it self does not seem to work:
    checkbox.setSelectedIcon(new ImageIcon("../images/selectedCheckBoxIcon.png"));
    Thanks for any ideas how to solve this!!

    Hi mKorbel, many thanks for your suggestion!
    For anyone interestsed,
    here is a small example of how I made it working.
    Unfortunately I cannot attatch the icon images that I use, but the selected icon can be downloaded from here, resize it to 32*32, remove the cross in the middle to save it as the unselected icon.
    * Modified sample code taken from here
    * http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingJCheckBoxCheckMarkIcon.htm
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.GridLayout;
    import java.net.URL;
    import javax.swing.AbstractButton;
    import javax.swing.ButtonModel;
    import javax.swing.Icon;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    public class IconCheckBoxSample {
      public static void main(String[] args) {
            JFrame frame = new JFrame("Iconizing CheckBox");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Icon checked = new CheckBoxIcon();
            Icon unchecked = new CheckBoxIcon();
            JCheckBox aCheckBox1 = new JCheckBox("Pizza", unchecked);
            aCheckBox1.setSelectedIcon(checked);
            JCheckBox aCheckBox2 = new JCheckBox("Calzone");
            aCheckBox2.setIcon(unchecked);
            aCheckBox2.setSelectedIcon(checked);
            Icon checkBoxIcon = new CheckBoxIcon();
            JCheckBox aCheckBox3 = new JCheckBox("Anchovies", checkBoxIcon);
            JCheckBox aCheckBox4 = new JCheckBox("Stuffed Crust", checked);
            frame.setLayout(new GridLayout(0,1));
            frame.add(aCheckBox1);
            frame.add(aCheckBox2);
            frame.add(aCheckBox3);
            frame.add(aCheckBox4);
            frame.setSize(300, 200);
            frame.setVisible(true);
    class CheckBoxIcon implements Icon {
      public void paintIcon(Component component, Graphics g, int x, int y) {
        AbstractButton abstractButton = (AbstractButton)component;
        ButtonModel buttonModel = abstractButton.getModel();
        if(buttonModel.isSelected()) 
            g.drawImage(createImage("../images/selectedCheckBoxIcon.png","info"), x, y, component);
        else
            g.drawImage(createImage("../images/unselectedCheckBoxIcon.png","info"), x, y, component);
      public int getIconWidth() {
        return 33;
      public int getIconHeight() {
        return 33;
      protected static Image createImage(String path, String description) {
            URL imageURL = CheckBoxIcon.class.getResource(path);
            Image icn = null;
            if (imageURL == null) {
                if(null==icn){
                    //System.out.println("path: "+path);
                    icn = new ImageIcon (CheckBoxIcon.class.getResource(path.replace("..",""))).getImage();
                    if(null!=icn)
                        return icn;
                    else{ 
                        System.err.println("Resource not found: " + path);
                        return null;
                 return null;
            } else {
                return (new ImageIcon(imageURL, description)).getImage();

Maybe you are looking for