Embedding HTML in the Title Bar of a JFrame

Hi Folks,
I have a simple question. Do you know I can I employ an HTML-enabled script in the title bar of a JFrame? I would like to make use of the subscript tag in HTML <sub>, yet it didn't work out:
public class MyFrame extends JFrame{
super("<html>KPC<sub>V.10</sub></html>");
}I don't know what I am doing wrong, but the title appears with the HTML tags, not in the way I would like it to be formatted. What would you suggest?
Regards,

The frame title is (typically) set in a native OS frame, which is not controlled by Java.
Perhaps if you tell Java to let the L&F control the frame decorations it might work, but probably not, as it would probably just try to mimic what the OS does anyway, which is to not support HTML.
So basically, you can't.

Similar Messages

  • Changing the logo in the Title Bar of a JFrame

    How do I change the logo in the left hand corner of the Title Bar of a JFrame window.

    Hi Sverigeterje
    Thanks.
    That's very neat. All done with one line of code, as opposed to the two lines of code I found in an answer (dated Jan 8, 2001) from Alexander Smirnov in response to a similar question (dated Sep 16, 2000) from Shawn Barker. (http://forums.java.sun.com/thread.jsp?forum=31&thread=49970 - Jan 8, 2001)
    ImageIcon image = new ImageIcon("CustomIcon.gif");
    this.setIconImage(image.getImage());
    Once again many thanks.
    George (aka cyberking1)

  • Setting an icon in the title bar of a JFrame...

    Hi,
    how do I set an image (icon) in the title bar of a JFrame (in the top left corner)?
    In JInternalFrame there is a method
    public void setFrameIcon(Icon icon)to set an image in the title bar of this internal frame - but in a JFrame I didn't find any method like this...
    Thanks in advance
    - Stephan

    Thanks ICE, that works for me...
    this.setIconImage(new ImageIcon("img\\foo.jpg").getImage());- Stephan

  • How to catch drag event in the title bar of a jframe

    Hi
    I want to catch the drag event in the title bar for jframe, because I have a few more window, dialogs, which I want to move along with my main window
    Thanks

    you can use a listener like tih one below...it works if you don't move to quickly.....
    class SynchroMover extends ComponentAdapter{
      private JFrame master;
      private JFrame[]slaves;
      private int currentX;
      private int currentY;
      public SynchroMover(JFrame master,JFrame[]slaves){
        this.master = master;
        this.slaves = slaves;
        currentX =(int) master.getLocation().getX();
        currentY =(int) master.getLocation().getY();
      public void componentMoved(ComponentEvent e){
        int dx = (int)master.getLocation().getX() - currentX;
        int dy = (int)master.getLocation().getY() - currentY;
        System.out.println(dx+" "+dy);
        for(int i=0;i<slaves.length;i++)
          slaves.setLocation((int)(slaves[i].getLocation().getX()+dx),(int)(slaves[i].getLocation().getY()+dy));
    currentX = (int)master.getLocation().getX();
    currentY = (int)master.getLocation().getY();
    the code isn't optimized...so you can probably do better

  • Getting rid or hide of the title bar without using jwidow

    hi everyone,
    is there any way to get rid or hide of the title bar in a Jframe without using JWindow because this one didn't conserve all the abilities a JFrame(listeners)...
    thanks in advance

    It is setUndecorated(true), but you'll need version 1.4 to use it. If you don't have it, then you use JWindow...
    http://java.sun.com/j2se/1.4/docs/api/javax/swing/JFrame.html

  • TextEdit won't let me rename duplicated .html files as a .html file (manually typing it) either in the Finder or the Title Bar by selecting Rename or Save.

    TextEdit won't let me rename duplicated .html files as a .html file (manually typing it) either in the Finder or the Title Bar by selecting Rename or Save.
    I am only able to rename a duplicated .html file right after I create it, because the file name gets highlighted in the Title Bar, but after that there is no recourse. I I can Rename or Save the file if I want to just save it as a .txt, but I need it to be .html. I guess I can manually change the file later, but it's really annoying.

    I remember long ago a similar issue with TextEdit, but I can't remember if there was a solution or not.
    Do you have it set to Display HTML files as HTML code and also deselect "When Saving a File: Add ".txt" extension to plain text files"

  • Complied chm file displays 'HTML help' on the title bar instead of the window name

    Complied chm file displays 'HTML help' on the title bar instead of the window name.
    I tried several ways like:
    1. Changed File>Project settings name and also set the language to English (US).
    2. Checked the Title name in .hhp file
    3. Used the window while compling.
    4. Robohelp language settings.
    5. Also uninstalled and reinstalled robophelp.
    But nothing helped
    The title name is displayed correctly if the same project is compiled on another machine.

    When the code in the HHP and the regional settings on a PC match, the correct title is displayed. Or other way around is also true the help title is displayed in the language specified in the help project IF (and only if) the regional settings of the PC match that language. Otherwise, "HTML Help" is displayed.
    Hope this help.
    Thanks and Regards,
    Rahul Karn

  • Can't drag windows around using the title bar-CS4

    I just upgraded to CS4 at work last week and I'm already regretting it. Firstly, using two monitors, CS4 must like my graphics card becasue as soon as I open a document and it begins to render the window, the main monitor loses it's signal and cuts off. So I have to hard shut down and make my 2nd monitor the main one, open CS4 and a file on that monitor, then make it the 2nd monitor and pass it over to my real first monitor with a file open and make that monitor the main one again. Added to that, randomly, files will open as tabs even though I have the option unchecked in prefs. I hate tabs, I want my windows floating. But I digress.
    My current issue is the file windows are not movable using the title bar. I can expand/contract every side grabbing the edge, but clicking, holding and dragging any of the title bar is ineffective. I can drag to tab to undock it, but once floating, the title bar is non-funtional for grabbing. I can also double click on it to tab, just not to drag.
    I use a mac at home and thankfully Adobe hasn't forced the edge to edge palette background on that platform. On the mac we get a 'classic view' or something that does away with the desktop blocking grey window background. Seriously, I can't stand the full screen look. Why can't windows have that option to have just the menu bar, palettes and file windows allowing the desktop to be visible? /rant

    A new video card is often a good idea if yours is over 2 years old.  Even the modern "budget" (e.g., ~$100) cards are hugely powerful nowadays.
    This page, I believe, could be a good starting point for everything you want to know:
    http://kb2.adobe.com/cps/404/kb404898.html
    This page, specifically, talks about tested video cards with Photoshop CS4:
    http://kb2.adobe.com/cps/405/kb405711.html
    A similar page for Photoshop CS5:
    http://kb2.adobe.com/cps/831/cpsid_83117.html
    -Noel

  • How to customize the title bar on my own Look And Feel?

    Hi all!
    I am creating my own Look and Feel which extends from NimbusLookAndFeel. What I'm doing is overwriting UIDefaults values??, referring to the Painters. For example:
    +uiDefault.put ("Button [Enabled]", new ButtonEnabledPainter());+
    But now I need is to customize the title bar of the JFrame's, but I do not see this option in Painter's values ??can be overwritten by Nimbus (http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults . html).
    You know as possible? I have to overwrite an existing UI component? The idea is I want to make the look and feel like SeaGlass, but the code seems a bit complex to know where to begin.
    I hope you can guide me on this issue.
    Thank you very much for everything! And excuse my English!.
    Greetings!

    very simple example, with direct methods
    import java.awt.*;
    import java.awt.event.*;
    import java.util.LinkedList;
    import java.util.Queue;
    import javax.swing.*;
    public class NimbusBorderPainterDemo extends JFrame {
        private static final long serialVersionUID = 1L;
        private JFrame frame = new JFrame();
        private JPanel fatherPanel = new JPanel();
        private JPanel contentPanel = new JPanel();
        private GradientPanel titlePanel = new GradientPanel(Color.BLACK);
        private JLabel buttonPanel = new JLabel();
        private Queue<Icon> iconQueue = new LinkedList<Icon>();
        public NimbusBorderPainterDemo() {
            iconQueue.add(UIManager.getIcon("OptionPane.errorIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.informationIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.warningIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.questionIcon"));
            JButton button0 = createButton();
            button0.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    frame.setExtendedState(ICONIFIED);
            JButton button1 = createButton();
            button1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    frame.setExtendedState(MAXIMIZED_BOTH | NORMAL);
                }//quick implemented, not correct you have to override both methods
            JButton button2 = createButton();
            button2.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int confirm = JOptionPane.showOptionDialog(frame,
                            "Are You Sure to Close Application?", "Exit Confirmation",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
                            null, null, null);
                    if (confirm == JOptionPane.YES_OPTION) {
                        System.exit(1);
            buttonPanel.setLayout(new GridLayout(0, 3, 5, 0));
            buttonPanel.setPreferredSize(new Dimension(160, 30));
            buttonPanel.add(button0);// JLabel is best and cross_platform JComponents
            buttonPanel.add(button1);// not possible put there witouth set Dimmnesion
            buttonPanel.add(button2);// and LayoutManager, work in all cases better
            titlePanel.setLayout(new BorderLayout());//than JPanel or JCompoenent
            titlePanel.add(new JLabel(nextIcon()), BorderLayout.WEST);
            titlePanel.add(new JLabel("My Frame"), BorderLayout.CENTER);
            titlePanel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
            titlePanel.add(buttonPanel, BorderLayout.EAST);
            JTextField field = new JTextField(50);
            JButton btn = new JButton("Close Me");
            btn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.exit(1);
            contentPanel.add(field);
            contentPanel.add(btn);
            fatherPanel.setLayout(new BorderLayout());
            fatherPanel.add(titlePanel, BorderLayout.NORTH);
            fatherPanel.add(contentPanel, BorderLayout.CENTER);
            frame.setUndecorated(true);
            frame.add(fatherPanel);
            frame.setLocation(50, 50);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            frame.setVisible(true);
            ComponentMover cm = new ComponentMover(frame, titlePanel);
            //by camickr http://tips4java.wordpress.com/2009/06/14/moving-windows/
        private JButton createButton() {
            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(nextIcon());
            button.setRolloverIcon(nextIcon());
            button.setPressedIcon(nextIcon());
            button.setDisabledIcon(nextIcon());
            nextIcon();
            return button;
        private Icon nextIcon() {
            Icon icon = iconQueue.peek();
            iconQueue.add(iconQueue.remove());
            return icon;
        private class GradientPanel extends JPanel {
            private static final long serialVersionUID = 1L;
            public GradientPanel(Color background) {
                setBackground(background);
            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if (isOpaque()) {
                    Color background = new Color(168, 210, 241);
                    Color controlColor = new Color(230, 240, 230);
                    int width = getWidth();
                    int height = getHeight();
                    Graphics2D g2 = (Graphics2D) g;
                    Paint oldPaint = g2.getPaint();
                    g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
                    g2.fillRect(0, 0, width, height);
                    g2.setPaint(oldPaint);
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
                    } catch (Exception fail) {
                    UIManager.getLookAndFeelDefaults().put("nimbusFocus", Color.RED);
                    NimbusBorderPainterDemo nimbusBorderPainterDemo = new NimbusBorderPainterDemo();
    }

  • Writing a specific text in the title bar of a content area

    Hallo,
    We have created several Content Areas which will be published as Webpage (NOT as Portlet to a Portal-Page! As example you can visit our Project Homepage http://pan.wsr.ac.at:7778/pls/portal30/url/FOLDER/ACCESSLAB/).
    Unfortunatly in the Title bar of the Browser there is always displayed the Title "Portal Content Area Builder".
    How can we change this Title to a more descriptive one for each specific Content Area respectively each Folder of a specific Content Area?
    Thanks,
    Christian

    The frame title is (typically) set in a native OS frame, which is not controlled by Java.
    Perhaps if you tell Java to let the L&F control the frame decorations it might work, but probably not, as it would probably just try to mimic what the OS does anyway, which is to not support HTML.
    So basically, you can't.

  • Hiding URL in the title bar of external window

    Experts -
    Scenario:
    On click of 'LinkToAction' element, we are opening up a pdf document (stored on portal content server)
    in an external window, using:
    CALL METHOD LO_WINDOW_MANAGER->CREATE_EXTERNAL_WINDOW
        EXPORTING
          URL            = LV_HOSTNAME
          TITLE          = 'My Title'                             "Does not work
          MODAL          = ABAP_FALSE
          HAS_MENUBAR    = ABAP_FALSE
          IS_RESIZABLE   = ABAP_TRUE
          HAS_SCROLLBARS = ABAP_TRUE
          HAS_STATUSBAR  = ABAP_FALSE
          HAS_TOOLBAR    = ABAP_FALSE
          HAS_LOCATION   = ABAP_FALSE
        RECEIVING
          WINDOW         = LO_WINDOW.
    We have a requirement to hide the location bar and the title of the window (in which the PDF is displayed). We are able to hide the location bar but the URL still appears in the title bar.
    We have tried the following code to set the title, but it is not working.
    CALL METHOD LO_WINDOW->SET_WINDOW_TITLE
      EXPORTING
        TITLE  = 'My Title.                    "Does not work
      LO_WINDOW->OPEN( ).
    Any help on how to achieve this will be appreciated.

    This is not a web dynpro restriction - but one that has been brough about by the browser designers.
    Because of the number of people falling to phishing attacks the designers of browser have all decided to always show the URL of any popup HTML windows. This stops malicious pop-ups from pretending to be something they are not and stealing user's data.
    If the world were a nicer place you could have your pop-up without the URL - but it isn't and it's probably better that your users have a least a little help in identifying if they are being scammed.
    Cheers,
    Chris

  • How to replace the icon in the title bar and minimized window

    I am not sure if this is a Swing question. But since nobody answered it in the Java Programming forum, let me place it here:
    I would like to set my own icon in the title bar and in the minimized window of my java application, replacing the java coffee cup icon.
    I am using:
    frame.setIconImage(new ImageIcon("image.gif").getImage())
    as was suggested previously in the Java Programming forum at:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5212059
    This does create the icon in both places. However, it only works when I run the program from JBuilder 2006. It doesn't work if I run the program from the .jar or the .exe file.
    How can I make it work for my .jar and .exe file?
    Please help! Thanks!

    It doesn't work if I run the program from the .jar...working example for a .jar
    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        JFrame f = new JFrame();
        Image img;
        try
          java.net.URL url = new java.net.URL(getClass().getResource("Save.gif"), "Save.gif");//correct capitalization required
          if (url != null)
            img = javax.imageio.ImageIO.read(url);
            f.setIconImage(img);
        catch(Exception e){}//do nothing - default will display
        f.setSize(200,200);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How can I get back the title bar in Thunderbird 38?

    The title bar can be turned on and off in Firefox. In the current version of Thunderbird (31), the title bar is present by default and there is no option to turn it off. In the beta version (38), there is no title bar by default… but I can't believe that there's no way to get it back. So, where is this setting? I can't find it.

    I sure agree that the setting isn't easily discoverable, but that's too late for the 38.0 release given that string freezes went in effect already (the reason being that localizers have to translate all UI elements for their respective language).
    The respective [https://bugzilla.mozilla.org/show_bug.cgi?id=814571 bug report] has been up for more than two years, but thus far not much progress in terms of a solution acceptable by the developers. I don't know if the extension proposed in the last comment was ever developed and posted.

  • Is there a way to modify the name displayed in the Title Bar at the top of the Audition Window?

    It's not uncommon for me to have a copy of Audition versions 1.5, 2.0 and 3.0 all open at the same time if I'm doing some editing for a complex project. 
    It would be handy for me to quickly see which window I have open without having to recognise the icons of the different versions.  At the moment, each Title Bar just displays the Audition icon and the words "Adobe Audition".  I'd like to add the version number to the name, if it's possible.  I'm happy to edit the Windows Registry, if that is what is needed.
    Does anybody know where the Title Bar information is stored?

    I have an answer you might like Howard.
    You could simply export one title to a PRTL file, then duplicate it using an Excel VB macro to change the name of the file based on a list in an excel file. You could type in a couple of dates, then just drag down to the 365th row and all of the dates would be there waiting for the macro to rename the file. Then, if you are really talented, you could find the appropriate text in the XML file and change it to match the name of the title, but without the PRTL extension.
    That way the font and position and style would all be right and the effort would be in a file you could share with the world.
    Hmmm. I might have to try that myself one of these days. Could come in handy. If you are more comfortable with Word than Excel, create the dates in Excel and paste them into a table in Word. Just be careful not to mess up the
    Edit: Oh, and of course, you import the titles back into Premiere Pro.

  • How do you make the title bar display different text than the page title?

    I'm looking for a way for the title bar display of my web page to be different than the text in the actual nav bar created by iWeb. For instance, I'd like the nav bar to just say Home for my main page, but in the title bar in the browser say "blah blah blah."
    I know there has to be a way to do this. iWeb has actually done it on one page already, but I can't figure out how. I think it picked up the title bar text from the first text box in the page. For instance, the page name in the navigation bar is "blahs for today" but the browser title bar when you open that page says "blah blah," which happens to be the first line of text on the page. The page title in iWeb.app, though, is "blahs for today." But if I look at the source code it lists title as "blah blah."
    I'm guessing I might be able to work around by making an invisible text box with the text that I want in the title bar as the very first thing on the page, and hope iWeb makes that the title bar text. I'd rather have a more correct way of doing it.
    Is there a way of doing this in the source code without having to change a lot of stuff?
    Thanks for any help.

    Richard Kirkman1 wrote:
    I think it picked up the title bar text from the first text box in the page. (...) I'm guessing I might be able to work around by making an invisible text box with the text that I want in the title bar...
    Richard ~ The key is the default Title box that iWeb creates for every new page — it's that which you need to edit, not another text box you've created. And to make the text in that Title box invisible, see here.

Maybe you are looking for

  • Importing CD's to external hard drive-can't find folders...

    I'm importing CD's to an external hard drive, but I can't find the folders. I've changed the Folder Location to the external drive, and I'm not copying them into the Music Folders. They don't seem to be saved on the external drive, nor are they in th

  • Getting total on the basis of non-primary key.

    Hi Experts, Iam having an internal table it_ekpo which is having material group(matkl),plant(werks) and net order value(netwr). My requrement is to get the total sum of NETWR against a particular plant which may have duplicates. I need to get the pla

  • How do I get album artwork off my phone onto my PC?

    I wiped my old PC and while I saved all my old MP3 files, I didn't think to save any of the old artwork. Of course, the files that Apple knows has the artwork but there are plenty that Apple doesn't recognize which I'd spent days gathering. I haven't

  • Consumption accounts not created as cost elements - Implications

    Hi There are following GL accounts as an Expense GL accounts: Cost of Raw Material Consumption Cost of Finished Goods Manufactured Cost of Finished Goods Sold Change in Stock WIP. I have not created them as cost elements since its asking me cost cent

  • Front row not on my computer.

    I bought my iMac of eBay and Front Row wasn't on it. Is there any way I can install it without the restore disks (I don't have them either!). Thanks.