Repaint() not repainting in JComponent

This code doesn't repaint itself when one of the methods to reposition the label is called (eg labelLeft()). I could really do with knowing why not.
<code>
import javax.swing.*;
import javax.swing.table.*;
import vdt.*;
import java.awt.*;
public class PreviewLabel extends JComponent{
JTable table;
Object[] label = {"Account ID","Accounts","MoreAccounts"};
Object[] columns = {label};
String[] columnNames1 = {"Label"};
JLabel icon;
Icon ico;
GridBagLayout gridbag;
GridBagConstraints c;
public PreviewLabel(Icon ico) {
super();
this.ico = ico;
icon = new JLabel(ico);
table = new JTable(new MyTableModel(columns,columnNames1));
gridbag = new GridBagLayout();
c = new GridBagConstraints();
setLayout(gridbag);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1.0;
protected void setup(JComponent comp,
GridBagLayout gridbag,
GridBagConstraints c) {
gridbag.setConstraints(comp, c);
add(comp);
System.out.println(comp);
public Icon getIcon(){
return ico;
public void setIcon(Icon icon){
this.ico = icon;
public void labelLeft(){
this.removeAll();
setup(icon, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
setup(table, gridbag, c);
public void labelTop(){
this.removeAll();
c.gridwidth = GridBagConstraints.REMAINDER; //end row
setup(icon, gridbag, c);
setup(table, gridbag, c);
public void labelBottom(){
this.removeAll();
c.gridwidth = GridBagConstraints.REMAINDER; //end row
setup(table, gridbag, c);
setup(icon, gridbag, c);
repaintAll();
public void labelRight(){
this.removeAll();
setup(table, gridbag, c);
c.gridwidth = GridBagConstraints.REMAINDER; //end row
setup(icon, gridbag, c);
</code>

I think you should try
invalidate()
validate()
rather than repaintAll();
When you invalidate() this calls the specific layout manager to redo the layout of the components

Similar Messages

  • JPopupMenu doesn't work when invoker is not a Swing JComponent ??

    I've written some code that uses a java.awt.Canvas to draw some stuff, and I want to be able to bring up a popup menu over the canvas.
    The problem is that when I try to show the popup menu with my Canvas as the invoker nothing happens: no popup menu appears.
    I also have problems with other AWT components (e.g. with java.awt.TextArea the popup comes up with two clicks but gets hidden behinf the popup that TextArea decides to provide).
    However everything works fine when I use a Swing widget (e.g. JTextArea or JPanel) as the invoker of my popup menu.
    Is this a bug or an undocumented feature?
    The JPopupMenu.show(...) method will happily accept any AWT Component as the invoker. Also the API documentation says nothing on this issue. Also the Swing tutorials doesn't say anything about this.
    I'm tempted to conclude this is an undocumented feature, but that suprises me. Surely I'm not the first person to try and use JPopupMenu with an AWT widget as invoker? Before I file a bug report, can someone tell me if I'm missing something here?
    I have some code to demonstrate this; all you have to do is comment one line and uncomment another to repoduce this behaviour. Let me know if you would like me to post it.

    Quick followup for anyone reading this topic:
    The suggestion of using JPanel and overriding paintComponent(...) is the way to go. I had thought of doing this to begin with, but felt it would be more effort. It's not. It's the same effort as using AWT canvas, but gives better results, and doesn't stuff up JPopupMenu or anything else that wants to interact with a lightweight component.

  • Open GL pipeline : Text are not displayed in JComponent

    Hello
    I have a problem: Using the opengl pipeline (-Dsun.java2d.opengl=True) on a very simple program
    which display a frame by screen device (two screens) with a JButton, i have the following effect:
    Using JRE 1.6_03 the button's text are displayed
    Using JRE 1.6_04 the text on one screen does not appear.
    In the two case, I have the message OpenGL pipeline enabled on screen 0:0 and 0:1.
    My configuration is:
    NVIDIA Quatro NVS 285
    xorg.conf configured in TwinView
    I have tried the several options (-Dsun.java2d.opengl.fbobject=false, etc.) but still doesn't work.
    Does someone can help Me ?
    What can this be explained.
    When I move the frame on which the text appear to the other one, the text dissapear !!!
    I only hace the following trace (J2D_TRACE_LEVEL=4) but I have it with the jre 1.3 and all work fine:
    "Could not fine an appropriate fbconfig"

    This sounds not entirely unrelated to this
    [http://forums.sun.com/thread.jspa?forumID=20&threadID=5365222|http://forums.sun.com/thread.jspa?forumID=20&threadID=5365222]
    The poster in that thread couldn't find a solution, just a workaround. If you do a search, there are several open bugs related to OpenGL and text. For example, this bug seems to describe exactly the same behavior as you just described, except with a different version of java. In the comments section of that bug is this
    I was able to workaround this problem by using the following flag: -Dawt.useSystemAAFontSettings=lcd

  • Delaying repaint until componentMoved event processed

    I have a problem in a specialised browser application I have written.
    The main display consists of a JPanel with JComponents added to it at absolute locations (Layout manager is set null). A Link object represents the link between two JComponents and holds a start and end location. In the 'Panel' class; the paintComponent method is overridden to render the link objects i.e. iterates thru link object list and draws a line from start to end point for each one.
    The Link object also implements the componentListener interface and listens for movement/resizing of its origin and destination JComponent. i.e. will dynamically change as JComponets are moved.
    Scenario- JComponent is moved to a different location: I believe this results in an automatic call to repaint the JComponent and consequentially the parent JPanel but will also cause a componentMoved event, which is then processed in the Link object,updating its start or end point.
    However the repaint is carried out before the componentMoved event , causing the links to be 'one move behind' the JComponent.
    How can I delay the repaint() on the event dispatching thread until the componentMoved event is processed.
    (I originally got round the problem by calling repaint()on the Panel at the end of the componentMoved method. But this means the whole display is painted twice for each user action. Since there are alot of scaled images and high definition images rendered, this is slow and jerky!)
    I am only starting to investigate use of different threads so any advice from experienced users appreciated
    thanks

    All repaing calls are delegated to the RepaintManager for that component and scheduled for painting.
    The RepaintManager is a convenient way to collapse fast occuring paints. In the end, the paint requests will be called from a SwingUtilities.invokeLater anyway, so just adding one more might not be the solution.
    Another, more obscure use of the RepaintManager, is exactly stopping unwanted paints. You can see this in the case of a JScrollPane. The viewport manages the movement of the view by changing its location. That calls repaint on the whole view component, event if the viewport size is very small. There are still a lot more things that the viewport does with the RepaintManager, but there is no need for that right now.
    In your case you can implement something like this:
    -- since your component is moved through the setLocation method you can override it with something like this:
    private Rectangle rectDirtyRegion;
    public void setLocation(int x, int y) {
        //call the actual moving operation
        super.setLocation(x, y);
        // get the RepaintManager for your component
        RepaintManager manager = RepaintManager.currentManager(this);
        // save the dirty region for your component
        rectDirtyRegion = manager.getDirtyRegion(this);
        // mark the component as clean so that no paint will take place.
        manager.markCompletelyClean(this);
    }Now, when you finally draw your link, you have to take care of marking the dirty regions again:
        RepaintManager.currentManager(this).addDirtyRegion(this, rectDirtyRegion.x, rectDirtyRegion.y, rectDirtyRegion.width, rectDirtyRegion.height);It is probably more work to it than in this simple example, but I am sure it can be accomplished. Study the RepaintManager behaviour and you might come with an even better solution.

  • Java.awt.Image getWidth() and getHeight() not working!

    Right- this is want I want to do.
    I have a background image which is added as a background image to a third party API class which extends Java.awt.Container. Such container is then added to the Content Pane of MyClass (which extends JFrame)
    I want to read the width and height of the image and resize MyClass accordingly.
    Problem is calling theImage.getWidth(MyClass.this) or theImage.getWidth(theThirdPartyAPIContainer) always return -1 and -1 denoting that no information is available.
    What do I need to do to obtain the height and width?

    Post here, cos don't know your email.
    Anyway
    - Can't use setPreferredSize because the Conatiner which is added to the ContentPane is a Awt Component not a Swing JComponent!
    - Also, the background is added AFTER the this.pack()and this.show().
    -I figured out that I could access Insets.top, Insets.left, Insets.right, Insets.bottom.
    I have basically the following
    |JMenuBar |
    L____________________________________________|
    | |
    | |
    | |
    | Third Party Class extending java.awt.Container |
    | containing an image of known size |
    | |
    L____________________________________________|
    I am fine for the width I do
    Insets frameInsets = this.getInsets();
    width = image.getWidth() + frameInsets.left + frameInsets.right;
    Height is the problem
    After some Trial an error it LOOKS on Solaris as if the following is right-
    height = image.getHeight()+frameInsets.top+ myJMenuBar.getSize()+getHeight+ myJMenuBar.getInsets().top + myJMenuBar.getInsets().bottom
    I cannot comprehend whether this is just a coincidence or not as I don't know why frameInsets.bottom should in any case be excluded.
    Here are the dimensions-
    frameInsets.left = 6
    frameInsets.right= 6
    frameInsets.top =28
    frameInsets.bottom = 6
    JMenuBar height = 23
    JMenuBar's Insets.top = 1
    JMenuBar's Insets.bottom = 1
    What should be the 'correct' calculations and does the Insets for the JMenuBar and the JFrame overlaps?

  • Extended characters not getting through VM properly in JDK1.4 versions

    This is on WIndows platform with regular US keyboard.
    When you type "ALT+0252" (it is �) from your regular (English) keyboard using it's numeric keypad, somewhere in the VM there is translation happening that is converting the numeric value of 252 to 242 and there by displaying the character mapped to ALT+0242 (which is �).
    Similarly, every other extended character is getting translated somewhere thereby displaying the wrong character.
    The way to look at Character Map on Windows platform is Start|Programs|Accessories|System Tools|Character Map.
    Best way to compare what is getting through VM is by running
    regular Notepad (Start | Programs | Accessories | Notepad) and typing
    above character and then running the Notepad that comes with J2SDK install (java -JAR JDKInstallDir\demo\jfc\Notepad\Notepad.jar) and typing the same character.
    You will notice that the regular Notepad displays � when you type ALT+0252 but the java Notepad displays � when you type the same ALT+0252 character.

    Here is the sample code. You can first run it in jdk1.3 environment and enter the extended characters in the textfield. You will notice that they get rendered correctly (such as ALT+0252 gets rendered as �)
    Then try running the same applet in jdk1.4 environment and enter the same extended characters in the textfield and you will notice the difference. ALT+0252 will now get rendered as � which is not correct.
    JComponent class in JDK1.4 seems to be translating the string some how before rendering it.
    Please let me know if you have any ideas or suggestions on this weird behavior in JDK1.4. Thanks.
    import javax.swing.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    public class DemoApplet extends JApplet
    public JTextField jtf = new JTextField ("Testing");
    public String text = "";
    public void init()
    jtf.addActionListener (new ActionListener() {
    public void actionPerformed(ActionEvent e)
    text = ((JTextField)e.getSource()).getText();
    try {
    System.out.println ("numeric value of text is : " + (int)(text.charAt (0)));
    catch (Exception ex)
    ex.printStackTrace ();
    JPanel pan = new JPanel ();
    pan.add (jtf);
    pan.validate();
    getContentPane().add (pan);

  • Does isEventDispatchThread() ever give false negatives?

    I decided to check to see any UI code gets run from outside the EDT. So I wrote a function that I could drop into locations of my code and have it call SwingUtilities.isEventDispatchThread() to verify that it is being called within the EDT.
    When I run the code, the function returns false. When I check the call stack the call stems from a invokeLater command from within a thread named AWT-EventQueue-0. Doesn't that mean that it really is in an Event Dispatch Thread? I am fairly new to Java so please enlighten me if I am misunderstanding this. I have read several Threading articles on this sight, and I am invoking the calls.
    here is the call to invokeLater
         SwingUtilities.invokeLater(new Runnable() {  
                public void run() {
             try{
                        threadSafeCall();
                  }catch( Exception e){
                        System.out.println("Exception in initialization");
          });Here is the threadSafeCall function
         private static void threadSafeCall(){
              AGTool window = new AGTool(lineArgs[0]);
              window.frame.setVisible(true);
         }Any thoughts or comments?
    Thanks
    Marc

    I just pulled down and itegrated CheckThreadViolationRepaintManager and it has the same behavior. I guess what I am asking is am I reading the stack right? It looks like the thread really is the EDT, yet the function call claims it is not. am I reading it right?
    Here is the call stack for the CheckThreadViolationRepaintManager.
    Note the bold line. that is the call made by the InvokeLater call.
    Thread [AWT-EventQueue-0] (Suspended (breakpoint at line 100 in CheckThreadViolationRepaintManager))     
         CheckThreadViolationRepaintManager.checkThreadViolations(JComponent) line: 100     
         CheckThreadViolationRepaintManager.addDirtyRegion(JComponent, int, int, int, int) line: 63     
         JPanel(JComponent).repaint(long, int, int, int, int) line: not available     
         JPanel(Component).repaint() line: not available     
         JPanel(JComponent).setFont(Font) line: not available     
         LookAndFeel.installColorsAndFont(JComponent, String, String, String) line: not available     
         BasicPanelUI.installDefaults(JPanel) line: not available     
         BasicPanelUI.installUI(JComponent) line: not available     
         JPanel(JComponent).setUI(ComponentUI) line: not available     
         JPanel.setUI(PanelUI) line: not available     
         JPanel.updateUI() line: not available     
         JPanel.<init>(LayoutManager, boolean) line: not available     
         JPanel.<init>(boolean) line: not available     
         JPanel.<init>() line: not available     
         JRootPane.createGlassPane() line: not available     
         JRootPane.<init>() line: not available     
         JFrame.createRootPane() line: not available     
         JFrame.frameInit() line: not available     
         JFrame.<init>() line: not available     
         AGTool.createContents() line: 271     
         AGTool.<init>(String) line: 240     
         AGTool.threadSafeCall() line: 122     
         AGTool.access$0() line: 121     
         AGTool$1.run() line: 108     
         InvocationEvent.dispatch() line: not available     
         EventQueue.dispatchEvent(AWTEvent) line: not available     
         EventDispatchThread.pumpOneEventForFilters(int) line: not available     
         EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: not available     
         EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: not available     
         EventDispatchThread.pumpEvents(int, Conditional) line: not available     
         EventDispatchThread.pumpEvents(Conditional) line: not available     
         EventDispatchThread.run() line: not available

  • Why do we need JRootPane ?

    Hello!
    My feeling about JRootPane is that it would have simpler to have
    JFrame, JDialog, JWindow, and JApplet (indirect) subclasses of
    JComponent. And so the class JRootPane would be useless.
    But it is not. anyone knows why?
    I guess that my question can be put in other words: Why JFrame, JDialog, ... do not inherit from JComponent?
    cheers,
    Alexandre

    You will find a very helpful description of the Swing Frame architecture in Using Top-Level Containers and a thorough discussion of Root Panes in How to Use Root Panes in the Tutorial.

  • JApplet question

    Can someone please tell me why the background color doesn't appear when I run this code?
    package javaapplication2;
    import java.awt.*;
    import javax.swing.JApplet;
    public class may19f extends JApplet {
        public void paint (Graphics page)
            setBackground(Color.orange);
            page.setColor(Color.black);
            page.drawRect(40,40,60,60);
            page.drawOval(20, 20, 30, 30);
            page.drawOval(90, 20, 30, 30);
    }

    cotton.m wrote:
    For starters you are over-riding the wrong method. JApplet means Swing. And custom Swing painting means overriding paintComponent. See the [_Swing Tutorial_|http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html]
    Although JApplet, not being a JComponent, lacks that method. But that's just a sign from JGod not to have the applet class do the painting!

  • PaintComponet(g) in Japplet? thanks- newbie here

    Hey guys, I have a JApplet with a series of jpanels. I would like to draw on the various panels independently. The forums have showed me that I need to use the paintComponent() method. well whenever i use the code..
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawImage(pic.getImage(),0,0,this);
    }it says that Error(433,11): method paintComponent(java.awt.Graphics) not found in class javax.swing.JApplet . What am I doing wrong? Thanks in advance!!!

    paintComponent is a method of class JComponent.
    JApplet is not derived from JComponent.
    Even if it where, it would be a mistake to do that.
    JApplet's job is to be a container: it should not be doing the drawing.
    Define subclasses of JPanel to do your custom drawing, and have your JApplet function as it normally does.

  • Class casting & class specific methods

    I have an array of JComponents, over which I iterate. Depending on the type of component(JLabel || JTextField), I will do different methods on the components, from which some are component type specific. Can I somehow do class casting to allow doing certain methods? Perhaps my code will clarify...
    // My 4 JComponents
    JLabel l1 = new JLabel("jl2");
    JTextField f1 = new JTextField();
    JLabel l2 = new JLabel("jl2");
    JTextField f2 = new JTextField();
    // And put them in array
    JComponent[] jc = new JComponent[6];
    jc[0] = l1;
    jc[1] = f1;
    jc[2] = l2;
    jc[3] = f2;
    if(jc[0][0] instanceof JLabel)
         /* This is what i want to do, but method "setText" exists only for JLabel,
         *  so my compiler complains that method setText is not valid for JComponent
         *  and class casting by:
         *  (JLabel)jc[0][0].setText("MyText");
         * is a syntax error
         jc[0][0].setText("MyText");
    // While this works just fine...
    JLabel l = null;
    if(jc[0][0] instanceof JLabel)
         l = (JLabel)jc[0][0];
         l.setText( "Mytext" );
    }

    I don't think that's entirely correct...
    You created a named reference to the object in your array, and now you create an anonymous reference. Either way, the object referenced is the same...

  • Need LayoutManager that resizes and supports right-aligned children

    I have two labels that I want to appear inside JPanels such that
    they have minimum 2 pixels padding between the text and the
    border of the JPanel, and the leftmost label is right justified, while
    the rightmost label is left justified. For example)
    [+++++label1++][++label2+++++]
    (the '+' represent white space/padding)
    Additionally, the panels themselves are children of a JPanel that is
    resized via a JSplitPane, so I want the labels to get truncated or
    expanded depending on the size of their containing JPanel.
    Lastly, I want to have the leftmost label right justified within its
    containing JPanel, and the rightmost label to be left justified within
    its containing JPanel.
    I've found that FlowLayout doesn't work because once my text is
    painted truncated, if the containing JPanel is resized larger, the
    label does not change to fill the space.
    What I'm seeing is that when the label is too large for the JPanel,
    it correctly gets truncated such as:
    [++lab...++]
    '+' represents white space/padding
    "..." implies truncated text
    but when the JPanel is grown, it simply adds padding to the current
    text that is painted:
    [+++++++lab...++]
    when I want it to expand the text and keep the result right justified:
    [++++++label1++]
    BoxLayout doesn't work because I can't find a way to get the text to
    be right-justified within the JPanel.
    BorderLayout isn't viable because while my example only shows a single
    label in the JPanel, I could actually have many components to add
    to the JPanel. So, I could create a JPanel to hold the many comps,
    but then that JPanel would have the same issue with layout.
    GridBag seems way overkill for what I need to do, which is simply,
    right justify text that will be react to contain panel bounds changes.
    Any advice is greatly appreciated.
    -Andy.

    Thanks for the reply. Unfortuneately, other circumstances prevent me from being
    able to do it that way :(
    I basically have very HTML-ish XML used to define a table.
    The table uses a GridBagLayout that lays out the <td>'s that are
    currently JPanel's. The <tr>'s do not create any JComponent as
    they are simply used to define attributes that are applied to all
    row <td>'s.
    My XML looks something like:
    <table>
      <tr>
        <td style="align: right; hgap: 2;"><label text="Hello"/></td>
        <td style="align: left; hgap: 2;"><label text="World"/></td>
      </tr>
    </table>So, when this is displayed it should show like:
    [++Hello++][++World++]
    or when it's shrunk, it should become something like:
    [++He...++][++Wo...++]
    and when the row is grown, it should become something like:
    [++++++Hello++][++World++++++]
    Also, since the GUI is defined in the XML, there can be many labels,
    images, etc inside one of the <td> tags, and I want them to be displayed
    L to R within the <td> in the order they appear, but I want them to be
    left or right justified with respect to the <td> JPanel.
    Maybe I can use a Box as my <td> instead of a JPanel so I can
    add a glue component on the left for right justified, and glue on the right
    (or no glue component) for left justified? I'll try that next...
    Thanks again for your help.
    -Andy.

  • VM problem displaying image?

    hi all,
    i have this code here
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class BackgroundSample {
    public static void main(String args[]) {
    JFrame frame = new JFrame("Background Example");
    final ImageIcon imageIcon = new ImageIcon("logo.gif");
    JTextArea textArea = new JTextArea() {
    Image image = imageIcon.getImage();
    Image grayImage = GrayFilter.createDisabledImage(image);
    {setOpaque(false);} // instance initializer
    public void paintComponent (Graphics g) {
    g.drawImage(grayImage, 0, 0, this);
    super.paintComponent(g);
    JScrollPane scrollPane = new JScrollPane(textArea);
    Container content = frame.getContentPane();
    content.add(scrollPane, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(3);
    frame.setSize(600, 600);
    frame.setVisible(true);
    it supose to show a background image called logo.
    but when i run i dont see the image. any ideas why? or maybe can someone just check if it works plz
    thanks

    The main reason why it isn't working is quite simple...
    When you override paintComponent you need to do it inside a class that
    extends a JComponent, such as JTextArea or JFrame.
    Your class (BackgroundSimple) does not extend a JComponent
    so your paintComponent method will never be called
    You need to extends the JTextArea or JFrame and then put your paintComponent method there.
    Another possible problem with your method is that
    super.paintComponent(g) might clear the screen (I'm not
    really sure) so just to test if the image appears you
    could move things aroung like this...
         public void paintComponent (Graphics g) {
              super.paintComponent(g);
              g.drawImage(grayImage, 0, 0, this);
         }

  • How to highlight text in JLabel????

    I m writing code for find functionality(similar to ctrl+f )..
    I have a JTable with some of its cell contains JLabel...
    I want to highlight some part of text from JLabel using using tableCellRenderer
    (eg. text on JLabel is "India" & my search keyword is "In", then only first two letters of JLabel should get highlighted)..
    It works, if Jtable contains string but not for any JComponent(like JLabel, JPanel, JCheckBox etc..) ..
    Please help me out for this....
    NOte: ---
    I m posting some part of code that i have used to highlight string in a JTable cell..
    public Component getTableCellRendererComponent(JTable table, Object value,
                                                         boolean isSelected, boolean hasFocus, int row, int column) {
                 // method to highlight WORD depending upon condition..
                           try {
                              high.addHighlight( i, j, highlight_painter );          // method to highlight word
                         catch (Exception e) {
                              e.printStackTrace();
                return this;
            }thanks in advance
    suyog

    I am posting my code that i am using for highlighting text in JTable...
    But this code is not working, if cell contains JLabel...
    Can you please suggest me any solution to work this code for JLabel with plain text content & with hyperlink (formatted using HTML tags), with out affecting to its original functionality
    (I am not getting what cramick want to suggest... )
    public class TableCellRendererBug{
         // code to highlight the specific WORD in JTable
         Vector vrecord;          // vector used in condition to highlight
         JTable tab;
         public  DefaultHighlighter high ;
             public void highlightWord(JTable table,Vector record){
                  tab=table;
                  vrecord =new Vector(1);
                  vrecord=record;
                  tab.setDefaultRenderer(Object.class, new CellHighlightRenderer());
        class CellHighlightRenderer extends JTextField implements TableCellRenderer {
              DefaultHighlighter.DefaultHighlightPainter highlight_painter =
                        new DefaultHighlighter.DefaultHighlightPainter(new Color(198,198,250));
             public  DefaultHighlighter high ;
            public CellHighlightRenderer() {
                 high = new DefaultHighlighter();       
                 setBorder( BorderFactory.createEmptyBorder() );
                setHighlighter(high);
                  tab.updateUI();
            public Component getTableCellRendererComponent(JTable table, Object value,
                                                         boolean isSelected, boolean hasFocus, int row, int column) {
                 // method to highlight WORD depending upon condition..
                    setFont(table.getFont());
                setValue(value);                    // intialize object
               *    condition to execute addHighlight..
               *    Here i am using  above mentioned Vector & all the things
               if(condition){
                          try {
                              high.addHighlight( start, end, highlight_painter );          // method to highlight word
                         catch (Exception e) {
                              e.printStackTrace();
                     }//if
                return this;
            protected void setValue(Object value) {
                 // method to initialize value of object
                 setText((value == null) ? "" : value.toString());
    }Thanks In advance..
    Suyog

  • JEditor Pane can shows HTML, and in AWT?

    Hello,
    I need to show a web page in a Frame, with hyperlinks. I have found that this is possible, and very easy in Swing, with a JEditorPane, but can I do this in AWT?
    Thank you.

    These are all in javax.swing.text or javax.swing.text.html packages, but an EditorKit extends to Object not to Component, JComponent, Container...
    Then these will not decrease speed. However, these could use a swing class :( but i don't think.
    If you see sources, they import java.awt or javax.swing.text.* but not javax.swing.*
    ( I didn't verify all class, then be careful )

Maybe you are looking for