Netbeans Paint Problem

I've got quite a strange problem I can't resolve. Currently, I have a program that can load an image and paint it on a jlabel in a scrollpane. The user can then drag rubberbanding transparent rectangles over areas of the image.
When I run the application in netbeans, it runs absolutely flawless and is very fast. However, as soon as I compile the application into a jar and run that from a console, the painting is suddenly very slow and laggy. I'm not imagining the change at all.
I'm currently using ubuntu and I had a few suggestions to make sure I was indeed running the sun java jre and not the gcj java on ubuntu, and I certainly am using the newest one.
Another note: The jar runs perfectly on windows and is as fast as it is in netbeans.
Is there some sort of drawing bug in the ubuntu version of java that I ran to, or does anyone have any other avenues to explore? I'm tearing my hair out over this one.

Have googled it? It seems to be a bug/error inMotif
(which is what AWT is based on Unix). Does the
warning have any other negative effect on your
application?my applet doesnt working i dont expect any more
negative effectsAre you sure this "doesnt working" is caused by the warning?
I use JDK 5 release 4 on Redhat 9 (not up to date) and also on Fedora Core 3 (up to date) with Netbeans 4.1 . I don't get a warning and both Netbeans and Applets work OK for me. I can run Applets from within Netbeans and from within Firefox.
Have you tried writing some simple test programs. Start with HelloWorld not using X and then create and AWT HelloWorld and then create an Applet HelloWorld.

Similar Messages

  • JMenuItem painting Problem

    Hi,
    I have painting problem with adding the JMenuItems dynamically. In the screen1 figure shown below, Menu 2 has has total 10 items, but initially we will show only three items. When the user clicks on the menu item ">>" all the Ten Items in Menu 2 are shown. But, All the 10 items are inserted in a compressed manner as shown in screen 2. When i click on the Menu 2 again, is shows properly as shown in screen 3.
    screen 1:
    <img src="http://img.photobucket.com/albums/v652/petz/Technical/screen1.jpg" border="0" alt="Screen 1"/>
    screen 2:
    <img src="http://img.photobucket.com/albums/v652/petz/Technical/screen2.jpg" border="0" alt="Screen 2"/>
    screen 3:
    <img src="http://img.photobucket.com/albums/v652/petz/Technical/screen3.jpg" border="0" alt="Screen 3"/>
    Here is the code:
    import java.awt.GridLayout;
    import java.awt.event.KeyEvent;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    public class MenuUI implements MouseListener
        JFrame frame;
        JMenuBar menubar;
        JMenu menu1,menu2;
        JMenuItem menuItem;
        JMenuItem lastMenuItem;
        String MENU1_ITEMS[] = {"ONE","TWO","THREE","FOUR","FIVE"};
        String MENU2_ITEMS[] = {"ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN"};
        int MIN_MENU = 3;
        public MenuUI()
            menubar = new JMenuBar();
            /*menu1 = new JMenu("Menu 1");
            menu1.setMnemonic(KeyEvent.VK_1);
            menu1.getPopupMenu().setLayout(new GridLayout(5,1));
            menu2 = new JMenu("Menu 2");
            menu2.setMnemonic(KeyEvent.VK_2);
            menu2.getPopupMenu().setLayout(new GridLayout(5,2));*/
            menu1 = new JMenu("Menu 1");
            menu1.setMnemonic(KeyEvent.VK_1);
            menu2 = new JMenu("Menu 2");
            menu2.setMnemonic(KeyEvent.VK_2);
            menubar.add(menu1);
            menubar.add(menu2);
            createMinMenuItems();
            frame = new JFrame("MenuDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setJMenuBar(menubar);
            frame.setSize(500, 300);
            frame.setVisible(true);
        public void createMinMenuItems()
            for (int i = 0; i < MIN_MENU; i++)
                menuItem = new JMenuItem(MENU1_ITEMS);
    menu1.add(menuItem);
    lastMenuItem = new JMenuItem(">>");
    lastMenuItem.addMouseListener(this);
    menu1.add(lastMenuItem);
    for (int i = 0; i < MIN_MENU; i++)
    menuItem = new JMenuItem(MENU2_ITEMS[i]);
    menu2.add(menuItem);
    lastMenuItem = new JMenuItem(">>");
    lastMenuItem.addMouseListener(this);
    menu2.add(lastMenuItem);
    private void showAllMenuItems(int menuNo)
    if(menuNo == 1)
    menu1.remove(MIN_MENU);
    for (int i = MIN_MENU; i < MENU1_ITEMS.length; i++)
    menuItem = new JMenuItem(MENU1_ITEMS[i]);
    menu1.add(menuItem);
    menu1.updateUI();
    else if(menuNo == 2)
    menu2.removeAll();
    menu2.getPopupMenu().setLayout(new GridLayout((MENU2_ITEMS.length),1));
    for (int i = 0; i < MENU2_ITEMS.length; i++)
    menuItem = new JMenuItem(MENU2_ITEMS[i]);
    //menuItem.setMinimumSize(new Dimension(35,20));
    menu2.add(menuItem);
    menu2.updateUI();
    //menu2.getPopupMenu().invalidate();
    //menu2.getPopupMenu().repaint();
    //menubar.repaint();
    //menubar.invalidate();
    //menubar.getParent().repaint();
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
    public void mousePressed(MouseEvent arg0)
    System.out.println("mousePressed: Menu 1 selected: "+menu1.isSelected());
    System.out.println("mousePressed: Menu 2 selected: "+menu2.isSelected());
    if(menu1.isSelected())
    System.out.println("mousePressed: Menu 1: Show All Items");
    showAllMenuItems(1);
    else if(menu2.isSelected())
    System.out.println("mousePressed: Menu 2: Show All Items");
    showAllMenuItems(2);
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
    public void mouseClicked(MouseEvent evt)
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
    public void mouseEntered(MouseEvent arg0)
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
    public void mouseExited(MouseEvent arg0)
    /* (non-Javadoc)
    * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
    public void mouseReleased(MouseEvent arg0)
    public static void main(String[] args)
    MenuUI ui = new MenuUI();

    // menu2.updateUI();
    menu2.getPopupMenu().setVisible(false);
    menu2.getPopupMenu().setVisible(true);

  • Paint problems in 1.4-RC1

    Is anyone else experiencing repaint problems with RC1? I've seen two intermittent things so far:
    1) When a modal JDialog is shown above its owner window, the contents of the owner window are being painted inside the JDialog
    2) Scroll bars (JScrollPane) are not being repainted properly when window is resized. Phantom scroll buttons remain at the old position.
    Any others out there?

    My JDK 1.4.0 Swing application does not paint very well on 2 out of 4 NT / SP5-6machines tested. Its OK on 2 machines and NOT OK on 2 others... The machines have mixture of different graphics cards.
    The base problem reminds me of 'running out of paint handles' in Win 3.1 days... i.e. the GUI fails to refresh and gets cluttered with 'random' strips, streched painting, general 'junk' that won't clear. Its quite serious because when the application window is moved the edit-box / buttons etc don't necessarily move at same time and get partially 'off the window' and stop working. Minimize/Maximize and drag overs by other apps don't clear it. The problem seems to get worse the longer the application is executed and seems to be even worse when there's more than 1 window up a time... i.e. it almost seems like 'lack of horsepower' in CPU but these machines are PIII 400MHZ with OK RAM so there should be enough CPU.
    Note that JDK 1.3 'corrects' the problem - i.e. running same code on JDK 1.3 (instead of JDK 1.4) works just fine and does NOT have the paint problems.
    ANY HELP APPRECIATED!!

  • Help Please, with Annoying painting problem.

    Hi:
    I keep running in to this annoying problem:
    Swing Components not being re-drawn properly after:
    Windows turns on the screensaver
    or to a lesser degree if the Java program is Iconified / deiconified.
    Components with Images on them get corrupted and the image is not drawn properly, maybe just the top cm or so, but it is annoying..
    And I can't figure out what or if anything I am doing wrong.
    It happens in a few of my applications.........
    mostly those wher I have overidden paintComponent()
    If someone would like to see if they have the same thing happen, below is an example that demonstrates the problem.
    You will probably need to fiddle with you power settings so that you monitor blanks after 1 min. to avoid having to wait too long.
    Run the program, wait for screen to blank out, bring screen back,...
    If the java picture is not corrupt try re-sizing the JFrame and see what happens.
    I am using Win98SE
    I have Java:
    java version "1.4.2-beta"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b19)
    Java HotSpot(TM) Client VM (build 1.4.2-beta-b19, mixed mode)
    I would appreciate someone trying this out. Even if it doesn't happen for them.
    Or maybe there is a glaring Error in my code.... And if so I could fix it..
    Here is an exmple program to demonstrate this.
    Two classes, The JPanel was obviously meant to do other things but I cut it down..
    The main:
    import java.awt.BorderLayout;
    import java.awt.Container;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.ImageIcon;
    import java.net.*;
    public class Test extends JFrame
         public Test()
              super("Test");
              Container content = this.getContentPane();
              content.setLayout( new BorderLayout() );
              URL url = null;
              Class ThisClass = this.getClass();
              url=ThisClass.getResource("Background.jpg");
              StarPanel panel = new StarPanel( url );
              content.add( panel , BorderLayout.CENTER );
              this.setDefaultCloseOperation(EXIT_ON_CLOSE);
              this.setSize(400,400);
              this.setVisible( true );
         public static void main( String[] args )
              Test Example = new Test();
    }The JComponent - with overrriden paintComponent()
    import java.awt.Image;
    import javax.swing.JComponent;
    import javax.swing.JPanel;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.MediaTracker;
    import java.awt.Toolkit;
    import java.net.*;
         cut down version
    public class StarPanel extends JPanel
    private Image image = null;
    private boolean imageLoaded = false;
         public StarPanel( URL imageLocation )
              super();
              this.setOpaque( true );
              loadImage( imageLocation );
         public boolean isOpaque()
              return true;
         public Image getImage()
              return this.image;
         public boolean hasImage()
              return imageLoaded;
         public void loadImage( URL imageLocation )
              boolean goodLoad = true;
              boolean Test = false;
              Toolkit T = this.getToolkit();
              image = T.getImage( imageLocation );
              prepareImage(image, this);
              MediaTracker Tracker = new MediaTracker( this );
              Tracker.addImage( image , 0 );
              try
                   Tracker.waitForID( 0 );
              catch( InterruptedException IE )
                   System.out.println( "Interrupted loading Image for StarPanel: " + IE.getMessage() );
                   goodLoad = false;
              Test = Tracker.isErrorID( 0 );
              if( Test )
                   goodLoad = false;
              if( !goodLoad )
                   imageLoaded = false;
              else
                   imageLoaded = true;
              Tracker = null;
         sans any error checking
         protected void paintComponent(Graphics g)
              super.paintComponent( g );
              Graphics2D g2D = (Graphics2D) g;
              boolean T = g2D.drawImage(this.getImage(), 0, 0, this.getWidth(), this.getHeight(), this );
    }I have tried quite a few different approaches to remove or minimize this problem, and have read everything I can here on paintComponent() and etc
    Help would be appreciated.
    No dukes cos I somehow have less than 0.
    Arrg my code was all neat - before I pasted it in to the code tags.

    I tried your code and did not notice any painting problems. I'm using JDK1.4.1 on Windows 98.
    I don't see any problems with your code. Here is the thread I usually recommend when people want to add an image to a component, in case you want to run another test:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=316074

  • Component paint problem:

    Hi everybody,
    I have just started playing with the Swing library
    recently, and I am experimenting with writing my
    own little customized component--a mini shape
    editor. There is one problem I am encountering.
    The circles that get re-drawn after a re-sizing
    of the window are crooked! However, when the
    circles were initially drawn to the compnent,
    they looked quite smooth. The only difference
    was that the circles were initially rendered
    via the graphics object that was obtained using
    the getGraphics() of the JComponent. I tried
    to force the paint method to use the graphics
    object returned from getGraphics(), but it
    does not rendered! Does anybody know what is
    the difference between these two graphics objects
    --the one returned from getGraphics() and the
    one passed into paint() by the system?
    Why am I getting the crooked line when the
    rendering is done via the paint graphics object?
    Thank you for your time in answering my question.
    --Chris

    Hi Richard,
    Thanks for your comments. As you suggested, I am
    posting some of my experimental code for discussion.
    Here is my derived class from JComponent:
    package SymbolEditorStuffs;
    import javax.swing.JComponent;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Graphics;
    public class SymbolEditorWidget extends JComponent {
    * Constructor for SymbolEditorWidget.
    public SymbolEditorWidget() {
    super();
    canvas = new Canvas(this);     
    // Register mouse listeners to detect mouse
    // events.
    addMouseMotionListener(
    new SymbolEditorMouseMotionAdopter());
    addMouseListener(
    new SymbolEditorMouseAdopter());
    public void toolChanged(String toolName) {
    canvas.toolChanged(toolName);
    public Graphics getWidgetGraphics() {
    // Return this component's graphics object.
    return super.getGraphics();
    protected void paintComponent(Graphics graphics) {
    // Let the base class paints the component first.
    super.paintComponent(graphics);
    // Then the canvas handles the customized
    // component painting.
    canvas.paintCanvas(graphics);
    protected class SymbolEditorMouseMotionAdopter
    extends MouseMotionAdapter {
    public SymbolEditorMouseMotionAdopter() {
    super();
    public void mouseDragged(
    MouseEvent mouseEvent) {
    // Canvas handles mouse drag event.
    canvas.mouseDragged(mouseEvent);
    protected class SymbolEditorMouseAdopter
    extends MouseAdapter {
    public SymbolEditorMouseAdopter() {
    super();
    public void mousePressed(
    MousEvent mouseEvent) {
    // Canvas handles mouse presse events.
    canvas.mousePressed(mouseEvent);     
    public void mouseReleased(
    MouseEvent mouseEvent) {
    // Canvas handles mouse released events.
    canvas.mouseReleased(mouseEvent);     
    public void mouseClicked(
    MouseEvent mouseEvent) {
    // Canvas handles mouse clicked events.
    canvas.mouseClicked(mouseEvent);
    private Canvas canvas;
    As you correctly pointed out, the code for my repaint
    should be situated in the paintComponent(..., which
    I have overriden with my version. I suspect the base
    class' version of this function does something significant;
    therefore, I made a call to the base class version as
    well.
    The mouse events are what I use to manipulate the
    shapes with. Therefore, a shape that has been manipulated via the mouse must re-draw itself.
    Since the MouseEvent class comes with a function
    to access the component that received the mouse
    events, I am able to get hold of the graphics object
    of that component via the getGraphics(... It is
    with this graphics object that I use to redraw the
    manipulated shape.
    However, it is not true that I have two sets of code
    that redraw a shape. All shapes inherit from an
    interface that has a draw(...:
    interface Shape {
    public void draw(Graphics graphics);
    public void undraw(Graphics graphics);
    etc.
    class CircleShape implements Shape {
    public void draw(Graphics graphics) {
    // Draws the circle at the right location.
    etc.
    etc.
    Utimately, all draws for a shape are funnelled into
    this function. The only difference is where the
    graphics object came from. In the paint case,
    the graphics object was handed to me via the
    system. In all other cases, I have gotten hold of
    the graphics object via the getGraphics(,,,
    What struck me as odd was that when I manipalated
    a circle with the mouse, which caused a redraw of
    the circle via the graphics that I obtained through the getGraphcs(..., and then I resided the window, the
    same circle was NOT rendered as around as before
    the resize of the window. Since I called the
    drawOval(... at precisely the same location in both
    times, I expect the circle to be rendered with exactly
    the same roundness. This should be true because
    the drawOval(... is applying the same algorithm to
    render the circle in both cases. The fact that they are
    not the same roundness is the mystery that I cannot
    explain! What I expected was that both rendering
    should have produced the exact same circle! But
    they did not--one is of lower roundness quality than
    the other!!
    --Chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Paint()  problems

    i was messing around and created a program that inside a JFrame there is a crosshair image that follows your mouse pointer and if you click the mouse, it leaves a red dot on that spot. The problem is that in order for the crosshair image not to create a trail of itself, i call repaint() from mouseMoved() to refill the entire background each time you move the mouse (fill rectangle of size of JFrame to background color in paint()). This works except it makes it so that when you click to leave a dot, those get erased as soon as you try to move the mouse. i thought about only refilling the small area where the crosshair last was before it moved instead of the entire JFrame but this could cause issues if you move the mouse over a spot that already has a red dot there (it will be erased). Cant think of a solution to this.

    In wsing the code that drow the content on the screne should be placed in the paintComponent method and in your mouseMove just save the coordinates where you should drow the image in to a variable and call repaint.
    The paintComponent should read the coordinates from the variables and do the drowing. To clean up of old drowing just call super.paintComponent from paint component before do any drowing

  • Java 2d - Painting problem

    hi, I have problem with painting. Every time, when I minimize and then maximize application, the whole screen starts to "repaint" it's content (everything what was drawed). Normally it's not so big problem you don't register it, but I'm using some delay when drawing (Thread.sleep (x) ), and
    then it's BIG problem, because always when minimized/maximized it starts to paint again and it's clearly visible...Also when I cover window of my application with another window, and then hide it, it do same thing. It's possible to avoid this? It's very unpleasant. thanx a lot
    PS: Do not tell me not to use delay :) It's absolutely necessary in my application, because I must use some animations...

    It does make logical sense if you were for instance calling the sleep method within a different thread, such as the EventQueue thread.
    Rather than use the sleep method to create your delays, use a javax.swing.Timer thread set to a specific delay.
    This way the animation is painted to the panel on a seperate thread.

  • Java Window Painting Problems

    I am just getting into Java so forgive me if this a newbie question because well, I'm a newbie.
    I downloaded JBuilder 6.0 and got to work learning the language. The problem is that anything I use written in the Java lanuage when I move the Window it scambles(We are talking aplications). So if IE was written in Java and you moved this window all the text and buttons will suddenly appear under the old ones when your mouse clicks or moves over them. So it apears that all the controls have shifted. Another problem is using the scroll bar makes the text apear scambled and like lines are going through them. The only way I know to fix this is force it to completly re-draw by Maximizing the window and then Minimizing it.
    I would really like to solve this problem so using Java opposed to C++ is practicle. I mean I do like to move the Windows around. My brother is having the same problem when he uses LimeWire; a Napster like program written in Java.
    I am running:
    Athlon XP 1.4ghz
    Asus A7V266 w/ 256 DDR(2100@CL2)
    Voodoo 3 3000
    Windows ME
    Everything Java is up to date.
    Thanks,
    ~`DarkEyes`~

    Hi,
    I am facing excatly the same problem as you've mentioned. I am not using Windows blind or anyother program to alter the look and feel of my OS.
    I am running WIN 2K Professional Edition. Any further information on this would really help as I have already spent days trying to solve the painting issue.
    Thanks,
    Y
    If anyone would like to know what was going on
    on I'll tell you. Basicly I use Litestep and
    WindowBlinds as a way that I can create my own OS
    design. Litestep Replaces the Explorer shell and you
    get to design now it looks, feels and enteracts. And
    WindowBlinds lets you skin and change the way Windows
    act.
    I should have though of this before, but what
    at happens is WindowBlinds has to intercept the Calls
    to draw the windows and then it draws then itself. The
    problem being I don't think as of right now it works
    when it intercepts Java calls.
    I'll just have to unload WindowBlinds when I program
    Java or use it. Not the best solution but its a
    start.
    Thanks for the help,
    ~`DarkEyes`~

  • Php curl connection & mysql connection from netbeans (jdbc) problem

    I set up a LAMP stack on my laptop for development of TYPO3 a cms. Everything is cushty but two issues remain where I'm at my wits end.
    In netbeans I cannot connect to the mysql database using the jdbc driver and specifying the localhost. My php application can using the same credentials.
    I realized that I cannot connect to the mysql from the command line either if I use the loopback dress.
    this works: mysql -u root -p -h localhost   
    this doesn't: mysql -u  root -p -h 127.0.0.1                                                                     
    > ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) 
    In my php application I have the problem that I cannot fetch a file via curl and fopen. I have tried both and curl/allow_fopen are enabled in the php.ini but no luck.
    since both problems are permission related it's only the /etc/hosts.allow which comes to mind which could cause a problem but I already allowed everything the hosts.allow
    # /etc/hosts.allow                                                                                         
    rpcbind: 192.168.1.0/255.255.255.0                                                                                                             
    mysqld: ALL : allow                                                                                                                           
    ALL: 127.0.0.1 : allow                                                                                                                         
    httpd: ALL : allow                                                                                                                             
    ALL : ALL : allow
    #/etc/hosts
    127.0.0.1               localhost       localhost.localdomain   lt-tom-arch                                                                   
    Any idea what I'm missing? What can I use to debug the issue further
    #php.ini
    [PHP]
    engine = On
    short_open_tag = Off
    asp_tags = Off
    precision = 14
    y2k_compliance = On
    output_buffering = 4096
    zlib.output_compression = Off
    implicit_flush = Off
    unserialize_callback_func =
    serialize_precision = 100
    allow_call_time_pass_reference = Off
    safe_mode = Off
    safe_mode_gid = Off
    safe_mode_include_dir =
    safe_mode_exec_dir =
    safe_mode_allowed_env_vars = PHP_
    safe_mode_protected_env_vars = LD_LIBRARY_PATH
    error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
    disable_functions =
    disable_classes =
    expose_php = On
    max_execution_time = 300
    max_input_time = 60
    memory_limit = 128M
    error_reporting = E_ALL & ~E_DEPRECATED
    display_errors = Off
    display_startup_errors = Off
    log_errors = On
    log_errors_max_len = 1024
    ignore_repeated_errors = Off
    ignore_repeated_source = Off
    report_memleaks = On
    track_errors = Off
    html_errors = Off
    error_log = /var/log/php.log
    variables_order = "GPCS"
    request_order = "GP"
    register_globals = Off
    register_long_arrays = Off
    register_argc_argv = Off
    auto_globals_jit = On
    post_max_size = 8M
    magic_quotes_gpc = Off
    magic_quotes_runtime = Off
    magic_quotes_sybase = Off
    auto_prepend_file =
    auto_append_file =
    default_mimetype = "text/html"
    include_path = ".:/usr/share/pear"
    doc_root =
    user_dir =
    extension_dir = "/usr/lib/php/modules/"
    enable_dl = Off
    file_uploads = On
    upload_max_filesize = 12M
    max_file_uploads = 20
    allow_url_fopen = On
    allow_url_include = On
    default_socket_timeout = 60
    extension=gettext.so
    extension=json.so
    extension=mcrypt.so
    extension=curl.so
    extension=gd.so
    extension=mysql.so
    extension=openssl.so
    [Date]
    date.timezone = America/Montreal
    [filter]
    [iconv]
    [intl]
    [sqlite]
    [sqlite3]
    [Pcre]
    [Pdo]
    [Pdo_mysql]
    pdo_mysql.cache_size = 2000
    pdo_mysql.default_socket=
    [Phar]
    [Syslog]
    define_syslog_variables = Off
    [mail function]
    SMTP = localhost
    smtp_port = 25
    mail.add_x_header = On
    [SQL]
    sql.safe_mode = Off
    [ODBC]
    odbc.allow_persistent = On
    odbc.check_persistent = On
    odbc.max_persistent = -1
    odbc.max_links = -1
    odbc.defaultlrl = 4096
    odbc.defaultbinmode = 1
    [Interbase]
    ibase.allow_persistent = 1
    ibase.max_persistent = -1
    ibase.max_links = -1
    ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
    ibase.dateformat = "%Y-%m-%d"
    ibase.timeformat = "%H:%M:%S"
    [MySQL]
    mysql.allow_local_infile = On
    mysql.allow_persistent = On
    mysql.cache_size = 2000
    mysql.max_persistent = -1
    mysql.max_links = -1
    mysql.default_port =
    mysql.default_socket =
    mysql.default_host =
    mysql.default_user =
    mysql.default_password =
    mysql.connect_timeout = 60
    mysql.trace_mode = Off
    [MySQLi]
    mysqli.max_persistent = -1
    mysqli.allow_persistent = On
    mysqli.max_links = -1
    mysqli.cache_size = 2000
    mysqli.default_port = 3306
    mysqli.default_socket =
    mysqli.default_host =
    mysqli.default_user =
    mysqli.default_pw =
    mysqli.reconnect = Off
    [mysqlnd]
    mysqlnd.collect_statistics = On
    mysqlnd.collect_memory_statistics = Off
    [Session]
    session.save_handler = files
    session.use_cookies = 1
    session.use_only_cookies = 1
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /
    session.cookie_domain =
    session.cookie_httponly =
    session.serialize_handler = php
    session.gc_probability = 1
    session.gc_divisor = 1000
    session.gc_maxlifetime = 1440
    session.bug_compat_42 = Off
    session.bug_compat_warn = Off
    session.referer_check =
    session.entropy_length = 0
    session.entropy_file =
    session.cache_limiter = nocache
    session.cache_expire = 180
    session.use_trans_sid = 0
    session.hash_function = 0
    session.hash_bits_per_character = 5
    url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
    [MSSQL]
    mssql.allow_persistent = On
    mssql.max_persistent = -1
    mssql.max_links = -1
    mssql.min_error_severity = 10
    mssql.min_message_severity = 10
    mssql.compatability_mode = Off
    mssql.secure_connection = Off
    [Assertion]
    [COM]
    [mbstring]
    [gd]
    [exif]
    [Tidy]
    tidy.clean_output = Off
    [soap]
    soap.wsdl_cache_enabled=1
    soap.wsdl_cache_dir="/tmp"
    soap.wsdl_cache_ttl=86400
    soap.wsdl_cache_limit = 5
    [sysvshm]
    [ldap]
    ldap.max_links = -1
    [mcrypt]
    [dba]
    #my.cnf
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    [mysqld]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    datadir = /var/lib/mysql
    skip-external-locking
    key_buffer = 16M
    max_allowed_packet = 1M
    table_cache = 64
    sort_buffer_size = 512K
    net_buffer_length = 16K
    myisam_sort_buffer_size = 8M
    skip-networking
    server-id = 1
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [mysql]
    [isamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    [myisamchk]
    key_buffer = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    [mysqlhotcopy]
    interactive-timeout

    Regarding Curl/fopen I'm one step further. PHP cannot resolve hostnames and can connect only if an IP is specified. I resolved the domain I needed manually in the hosts file and it works. it appears it cannot use the systems DNS or the system doesn't allow it to use DNS. I have other ubuntu servers in the network who can resolve just fine.
    any idea what could be causing this?
    Could it have something to do with my nsswitch.conf? Should there be another dns somewhere?
    # Begin /etc/nsswitch.conf
    passwd: files
    group: files
    shadow: files
    publickey: files
    hosts: files dns
    networks: files
    protocols: files
    services: files
    ethers: files
    rpc: files
    netgroup: files
    # End /etc/nsswitch.conf

  • Report painter problem very urgent

    Hi to ALL,
    I have prepared two reports of cost centre through report painter. The format is proper is both the reports. The set is also correct and values in set(i.e cost centres) are also properly
    but when we execute the report one report is being executed properly while other shows zero values. only when i doubleclick on zero amt and go to plan line items then it shows me values for that particular row in report.
    Why is it so? what is solution to it? can it be possible that my tables are not correct. Ia m using CCSS table.
    Pls this is very urgent
    Thanks in advance
    Tanuja

    Hi
    Can you check one thing...after selecting the zero you are getting the line item...chekc the total of that items...if it is coming zero..then no problem.
    If not you can check in the no.format of that report. If you select the lacs format and your amount is below ten thousand...you will get the zero value only
    VVR

  • Report Painter problem with empty selection variant

    Hello,
    I use the cost center selection variant for the column definition in Report Painter as characteristic value. This selection variant get only the cost centers which are valid from 1.1.2003 to 31.12.2004. The column of the report created by Report Painter which uses this selection variant display value without taking into account limitations follow from this selection variant. I expect value zero for year fiscal year 2007 in this column, because the cost centers are invalid in 2007 year but the report displays different value. The problem appeared after upgrade from 4.6C to ECC 6.0.
    Best Regards
    ZD

    My problem with Report Painter occurred when I was creating my own report based on 1VK library.
    In my example I used in the column definition characteristic Cost
    Center, which is determined by selection variant, and Basic Key Figure
    equal SWKG-Costs. For system date (18.07.2007) there are no valid
    master data for the characteristic Cost Center but when I execute
    report for fiscal year 2007 the column display no-zero value without
    taking into account value of Characteristic Cost Center. I expected
    zero value in this column because there are no postings for Cost
    Centers (no valid cost centers were selected) in financial year 2007.
    Could you help me with this problem ?

  • Screen painter problem

    Hi everyone,
    In screen painter, I would call the current screen before output module. But it tells 'the statement is not accessible' when I active the programme. What's the problem? Thanks!!

    call under start of selection event.
    start-of-selection.
    call screen 100.

  • Please Help.  NetBeans IDE Problem + rt.jar.  Trouble compiling MIDlets.

    Hi all. For the past few weeks I have undertaken learning Java for mobile devices. I am having a slight problem with NetBeans 5.5 which I would appreciate help in fixing.
    Currently installed on my system:-
    - Wireless Toolkit 2.5
    - NetBeans IDE 5.5 + Mobility Pack
    - j2sdk1.4.2_13
    - jdk1.6.0
    - jre1.6.0
    - javaee sdk5_02
    (So pretty much every Java application!)
    Now the problem. Basically, if I import the following at the beginning for my MIDlet...
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;... the java.sql has red line underneath saying "package does not exist". Now, what I found is that I need to import .jar files into the Library section. I managed to fix the javax.servlet package and some others, by importing the correct .jar files, but I found that to remove the red line for java.sql I need rt.jar.
    However, this is located under one of my jre folders and not the j2me / jdk folders I have. Even though it removes the red line, when I compile the project I keep receiving "PREVERIFY" errors and "CONSTANT POOL" errors.
    Yet, if I remove the rt.jar file, these go away, but it won't compile then because it says the package is missing (back to square one!).
    So, any ideas please??? I have spent days and days just adding random .jar files to try and fix the problem but to no avail. An example of current imported .jar files in NetBeans:-
    - rt.jar
    - midpapai.zip
    - jdbc.jar
    - servlet.jar
    - runtime12.jar
    - classes12.jar
    - ojdbc.jar
    Try not to be too technical, I've only just started out. Lol. Thanks in advance!!

    well... J2ME world is quite diffirent from usual Java. Actually you will not be able to use much of the staff, that you have imported, including java.io.* (it will be only available in CDC), java.servlet.*, java.servlet.http.*, java.sql.*
    So don't even try to find where are those packages are located....
    Try from simple tutorial like:
    http://developers.sun.com/techtopics/mobility/midp/articles/wtoolkit/
    Or from documentation on Netbeans.org:
    http://www.netbeans.org/kb/trails/mobility.html

  • Groupable + multiline table header paint problem

    hi, i try to make a groupable + multiline table header
    based on Nobuo Tamesama's code...
    there are some problems which i considered tolerable except one...
    the header didn't paint correctly when i set the autoResizeMode into autoresizemode_off
    and resize the columns pass the scrollpane width...
    thx in advance
    here's the complete code :
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.util.*;
    import javax.swing.border.*;
    import javax.swing.plaf.basic.*;
    public class GroupableHeaderExample extends JFrame {
        GroupableHeaderExample() {
            super("Groupable Header Example");
            JScrollPane sp = new JScrollPane();
            Object[][] data = {{"b1k1", "b1k2", "b1k3", "b1k4", "b1k5"}, {"b2k1", "b2k2", "b2k3", "b2k4", "b2k5"}};
            JTable table = new JTable(new DefaultTableModel(data, new Object[]{"Kol1", "Kol2\nmmm", "Kol3", "kol4\nmmm\nnnn", " \n \nKol5\nmmm"})) {
                protected JTableHeader createDefaultTableHeader() {
                    return new GroupableTableHeader(columnModel);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            ColumnGroup cg = new ColumnGroup("CG", 0, 3);
            ColumnGroup cg2 = new ColumnGroup("CG2\nmmm", 1, 3);
            ColumnGroup cg3 = new ColumnGroup("CG3", 1, 2);
            GroupableTableHeader header = (GroupableTableHeader)table.getTableHeader();
            header.addColumnGroup(cg3);
            header.addColumnGroup(cg);
            header.addColumnGroup(cg2);
            header.fitHeight();
            sp.setViewportView(table);
            getContentPane().add(sp);
            setSize(400, 300);  
        public static void main(String[] args) {
            GroupableHeaderExample frame = new GroupableHeaderExample();
            frame.addWindowListener( new WindowAdapter() {
                public void windowClosing( WindowEvent e ) {
                    System.exit(0);
            frame.setVisible(true);
    class GroupableTableHeader extends JTableHeader {
        private Vector<ColumnGroup> columnGroups = new Vector<ColumnGroup>(1, 1);
        public GroupableTableHeader(TableColumnModel model) {
            super(model);
            setUI(new GroupableTableHeaderUI());
            setReorderingAllowed(false);
        public void addColumnGroup(ColumnGroup cg) {
            if(columnGroups.size() == 0) {
                columnGroups.addElement(cg);
                return;
            int size = columnGroups.size();
            for(int i = 0; i < size; i++) {
                if(cg.getLength() > ((ColumnGroup)columnGroups.elementAt(i)).getLength())
                    columnGroups.insertElementAt(cg, i);
                else {
                    if(i == size - 1)
                        columnGroups.addElement(cg);           
        public void fitHeight() {
            int[] counter = new int[getTable().getColumnCount()];
            for(int i = 0; i < getTable().getColumnCount(); i++) {
                int level = 0;
                for(int j = 0; j < columnGroups.size(); j++) {
                    if(i >= ((ColumnGroup)columnGroups.elementAt(j)).getStartIndex() && i <= ((ColumnGroup)columnGroups.elementAt(j)).getEndIndex())
                        level = level + getNewLineCount(((ColumnGroup)columnGroups.elementAt(j)).getText());
                counter[i] = level + getNewLineCount(table.getColumnModel().getColumn(i).getHeaderValue().toString());
            int maxCounter = counter[0];
            for(int i = 0; i < counter.length; i++) {
                if(counter[i] > maxCounter)
                    maxCounter = counter;
    setPreferredSize(new Dimension(100, (maxCounter) * 20));
    public Vector getColumnGroups() {
    return columnGroups;
    public int getNewLineCount(String str) {
    BufferedReader br = new BufferedReader(new StringReader(str));
    String line;
    Vector<String> v = new Vector<String>(1, 1);
    try {           
    while((line = br.readLine()) != null) {
    v.addElement(line);
    catch(IOException ex) {
    JOptionPane.showMessageDialog(null, ex.getMessage(), "Informasi", JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    int i = 0;
    boolean b = false;
    for(i = 0; i < v.size(); i++) {
    for(int j = 0; j < v.elementAt(i).length(); j++) {
    if(v.elementAt(i).charAt(j) != ' ') {
    b = true;
    break;
    if(b)
    break;
    if(i == v.size())
    i = 0;
    return v.size() - i;
    public void updateUI(){
    setUI(new GroupableTableHeaderUI());
    class GroupableTableHeaderUI extends BasicTableHeaderUI {     
    public void paint(Graphics g, JComponent c) {
    TableCellRenderer renderer = new MultiLineHeaderRendererEx();
    Component[] cmp = new Component[header.getColumnModel().getColumnCount()];
    Vector cg = ((GroupableTableHeader)header).getColumnGroups();
    Component[] cmpGroup = new Component[cg.size()];
    TableColumnModel tcm = header.getTable().getColumnModel();
    for(int i = 0; i < cmpGroup.length; i++) {
    cmpGroup[i] = renderer.getTableCellRendererComponent(header.getTable(), ((ColumnGroup)cg.elementAt(i)).getText(), false, false, -1, i);
    rendererPane.add(cmpGroup[i]);
    int x = 0;
    int y = 0;
    int height = 20 * ((GroupableTableHeader)header).getNewLineCount(((ColumnGroup)cg.elementAt(i)).getText());
    for(int j = 0; j < ((ColumnGroup)cg.elementAt(i)).getStartIndex(); j++)
    x += tcm.getColumn(j).getWidth();
    for(int j = 0; j < cmpGroup.length; j++) {
    if(i == j)
    continue;
    if(((ColumnGroup)cg.elementAt(i)).getStartIndex() >= ((ColumnGroup)cg.elementAt(j)).getStartIndex() && ((ColumnGroup)cg.elementAt(i)).getEndIndex() <= ((ColumnGroup)cg.elementAt(j)).getEndIndex())
    y = ((ColumnGroup)cg.elementAt(j)).getY() + ((ColumnGroup)cg.elementAt(j)).getHeight();
    ((ColumnGroup)cg.elementAt(i)).setY(y);
    ((ColumnGroup)cg.elementAt(i)).setHeight(height);
    int width = 0;
    for(int j = ((ColumnGroup)cg.elementAt(i)).getStartIndex(); j <= ((ColumnGroup)cg.elementAt(i)).getEndIndex(); j++)
    width += tcm.getColumn(j).getWidth();
    rendererPane.add(cmpGroup[i]);
    rendererPane.paintComponent(g, cmpGroup[i], header, x, y, width, height, true);
    for(int i = 0; i < cmp.length; i++) {
    cmp[i] = renderer.getTableCellRendererComponent(header.getTable(), header.getColumnModel().getColumn(i).getHeaderValue(), false, false, -1, i);
    rendererPane.add(cmp[i]);
    int x = 0;
    int y = 0;
    for(int j = 0; j < i; j++)
    x += tcm.getColumn(j).getWidth();
    for(int j = 0; j < cmpGroup.length; j++) {
    if(i >= ((ColumnGroup)cg.elementAt(j)).getStartIndex() && i <= ((ColumnGroup)cg.elementAt(j)).getEndIndex())
    y = ((ColumnGroup)cg.elementAt(j)).getY() + ((ColumnGroup)cg.elementAt(j)).getHeight();
    rendererPane.add(cmp[i]);
    rendererPane.paintComponent(g, cmp[i], header, x, y, tcm.getColumn(i).getWidth(), (header.getPreferredSize().height - y), true);
    class MultiLineHeaderRendererEx extends JList implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    if(((GroupableTableHeader)table.getTableHeader()).getNewLineCount(value.toString()) == 1) {
    JLabel header = new JLabel();
    header.setForeground(table.getTableHeader().getForeground());
    header.setBackground(table.getTableHeader().getBackground());
    header.setFont(table.getTableHeader().getFont());
    header.setHorizontalAlignment(JLabel.CENTER);
    header.setText(value.toString());
    header.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    return header;
    else {
    setOpaque(true);
    setForeground(UIManager.getColor("TableHeader.foreground"));
    setBackground(UIManager.getColor("TableHeader.background"));
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    setFont(UIManager.getFont("TableHeader.font"));
    ListCellRenderer renderer = getCellRenderer();
    ((JLabel)renderer).setHorizontalAlignment(SwingConstants.CENTER);
    setCellRenderer(renderer);
    String str = value.toString();
    BufferedReader br = new BufferedReader(new StringReader(str));
    String line;
    Vector<String> v = new Vector<String>(1, 1);
    try {           
    while((line = br.readLine()) != null) {
    v.addElement(line);
    catch(IOException ex) {
    JOptionPane.showMessageDialog(null, ex.getMessage(), "Informasi", JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    setListData(v);
    return this;

    OMG ! the code i posted before is incomplete
    sorry...
    here's the complete one, pls help :
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.util.*;
    import javax.swing.border.*;
    import javax.swing.plaf.basic.*;
    public class GroupableHeaderExample extends JFrame {
        GroupableHeaderExample() {
            super("Groupable Header Example");
            JScrollPane sp = new JScrollPane();
            Object[][] data = {{"b1k1", "b1k2", "b1k3", "b1k4", "b1k5"}, {"b2k1", "b2k2", "b2k3", "b2k4", "b2k5"}};
            JTable table = new JTable(new DefaultTableModel(data, new Object[]{"Kol1", "Kol2\nmmm", "Kol3", "kol4\nmmm\nnnn", "Kol5\nmmm"})) {
                protected JTableHeader createDefaultTableHeader() {
                    return new GroupableTableHeader(columnModel);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            ColumnGroup cg = new ColumnGroup("CG", 0, 4);
            ColumnGroup cg2 = new ColumnGroup("CG2\nmmm", 1, 4);
            ColumnGroup cg3 = new ColumnGroup("CG3", 1, 2);
            ColumnGroup cg4 = new ColumnGroup("CG4", 3, 4);
            GroupableTableHeader header = (GroupableTableHeader)table.getTableHeader();
            header.addColumnGroup(cg4);
            header.addColumnGroup(cg2);
            header.addColumnGroup(cg3);
            header.addColumnGroup(cg);
            header.fitHeight();
            sp.setViewportView(table);
            getContentPane().add(sp);
            setSize(400, 300);  
        public static void main(String[] args) {
            GroupableHeaderExample frame = new GroupableHeaderExample();
            frame.addWindowListener( new WindowAdapter() {
                public void windowClosing( WindowEvent e ) {
                    System.exit(0);
            frame.setVisible(true);
    class GroupableTableHeader extends JTableHeader {
        private Vector<ColumnGroup> columnGroups = new Vector<ColumnGroup>(1, 1);
        public GroupableTableHeader(TableColumnModel model) {
            super(model);
            setUI(new GroupableTableHeaderUI());
            setReorderingAllowed(false);
        public void addColumnGroup(ColumnGroup cg) {
            if(columnGroups.size() == 0) {
                columnGroups.addElement(cg);
                return;
            int size = columnGroups.size();
            for(int i = 0; i < size; i++) {
                if(cg.getLength() > ((ColumnGroup)columnGroups.elementAt(i)).getLength()) {
                    columnGroups.insertElementAt(cg, i);
                    break;
                else {
                    if(i == size - 1)
                        columnGroups.addElement(cg);           
        public void fitHeight() {
            int[] counter = new int[getTable().getColumnCount()];
            for(int i = 0; i < getTable().getColumnCount(); i++) {
                int level = 0;
                for(int j = 0; j < columnGroups.size(); j++) {
                    if(i >= ((ColumnGroup)columnGroups.elementAt(j)).getStartIndex() && i <= ((ColumnGroup)columnGroups.elementAt(j)).getEndIndex())
                        level = level + getNewLineCount(((ColumnGroup)columnGroups.elementAt(j)).getText());
                counter[i] = level + getNewLineCount(table.getColumnModel().getColumn(i).getHeaderValue().toString());
            int maxCounter = counter[0];
            for(int i = 0; i < counter.length; i++) {
                if(counter[i] > maxCounter)
                    maxCounter = counter;
    setPreferredSize(new Dimension(100, (maxCounter) * 20));
    public Vector getColumnGroups() {
    return columnGroups;
    public int getNewLineCount(String str) {
    BufferedReader br = new BufferedReader(new StringReader(str));
    String line;
    Vector<String> v = new Vector<String>(1, 1);
    try {           
    while((line = br.readLine()) != null) {
    v.addElement(line);
    catch(IOException ex) {
    JOptionPane.showMessageDialog(null, ex.getMessage(), "Informasi", JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    int i = 0;
    boolean b = false;
    for(i = 0; i < v.size(); i++) {
    for(int j = 0; j < v.elementAt(i).length(); j++) {
    if(v.elementAt(i).charAt(j) != ' ') {
    b = true;
    break;
    if(b)
    break;
    if(i == v.size())
    i = 0;
    return v.size() - i;
    public void updateUI(){
    setUI(new GroupableTableHeaderUI());
    class GroupableTableHeaderUI extends BasicTableHeaderUI {     
    public void paint(Graphics g, JComponent c) {
    TableCellRenderer renderer = new MultiLineHeaderRendererEx();
    Component[] cmp = new Component[header.getColumnModel().getColumnCount()];
    Vector cg = ((GroupableTableHeader)header).getColumnGroups();
    Component[] cmpGroup = new Component[cg.size()];
    TableColumnModel tcm = header.getTable().getColumnModel();
    for(int i = 0; i < cmpGroup.length; i++) {
    cmpGroup[i] = renderer.getTableCellRendererComponent(header.getTable(), ((ColumnGroup)cg.elementAt(i)).getText(), false, false, -1, i);
    int x = 0;
    int y = 0;
    int height = 20 * ((GroupableTableHeader)header).getNewLineCount(((ColumnGroup)cg.elementAt(i)).getText());
    for(int j = 0; j < ((ColumnGroup)cg.elementAt(i)).getStartIndex(); j++)
    x += tcm.getColumn(j).getWidth();
    for(int j = 0; j < cmpGroup.length; j++) {
    if(i == j)
    continue;
    if(((ColumnGroup)cg.elementAt(i)).getStartIndex() >= ((ColumnGroup)cg.elementAt(j)).getStartIndex() && ((ColumnGroup)cg.elementAt(i)).getEndIndex() <= ((ColumnGroup)cg.elementAt(j)).getEndIndex())
    y = ((ColumnGroup)cg.elementAt(j)).getY() + ((ColumnGroup)cg.elementAt(j)).getHeight();
    ((ColumnGroup)cg.elementAt(i)).setY(y);
    ((ColumnGroup)cg.elementAt(i)).setHeight(height);
    int width = 0;
    for(int j = ((ColumnGroup)cg.elementAt(i)).getStartIndex(); j <= ((ColumnGroup)cg.elementAt(i)).getEndIndex(); j++)
    width += tcm.getColumn(j).getWidth();
    rendererPane.add(cmpGroup[i]);
    rendererPane.paintComponent(g, cmpGroup[i], header, x, y, width, height, true);
    for(int i = 0; i < cmp.length; i++) {
    cmp[i] = renderer.getTableCellRendererComponent(header.getTable(), header.getColumnModel().getColumn(i).getHeaderValue(), false, false, -1, i);
    int x = 0;
    int y = 0;
    for(int j = 0; j < i; j++)
    x += tcm.getColumn(j).getWidth();
    for(int j = 0; j < cmpGroup.length; j++) {
    if(i >= ((ColumnGroup)cg.elementAt(j)).getStartIndex() && i <= ((ColumnGroup)cg.elementAt(j)).getEndIndex())
    y = ((ColumnGroup)cg.elementAt(j)).getY() + ((ColumnGroup)cg.elementAt(j)).getHeight();
    rendererPane.add(cmp[i]);
    rendererPane.paintComponent(g, cmp[i], header, x, y, tcm.getColumn(i).getWidth(), (header.getPreferredSize().height - y), true);
    class MultiLineHeaderRendererEx extends JList implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    if(((GroupableTableHeader)table.getTableHeader()).getNewLineCount(value.toString()) == 1) {
    JLabel header = new JLabel();
    header.setForeground(table.getTableHeader().getForeground());
    header.setBackground(table.getTableHeader().getBackground());
    header.setFont(table.getTableHeader().getFont());
    header.setHorizontalAlignment(JLabel.CENTER);
    header.setText(value.toString());
    header.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    return header;
    else {
    setOpaque(true);
    setForeground(UIManager.getColor("TableHeader.foreground"));
    setBackground(UIManager.getColor("TableHeader.background"));
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    setFont(UIManager.getFont("TableHeader.font"));
    ListCellRenderer renderer = getCellRenderer();
    ((JLabel)renderer).setHorizontalAlignment(SwingConstants.CENTER);
    setCellRenderer(renderer);
    String str = value.toString();
    BufferedReader br = new BufferedReader(new StringReader(str));
    String line;
    Vector<String> v = new Vector<String>(1, 1);
    try {           
    while((line = br.readLine()) != null) {
    v.addElement(line);
    catch(IOException ex) {
    JOptionPane.showMessageDialog(null, ex.getMessage(), "Informasi", JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    setListData(v);
    return this;
    class ColumnGroup {
    private String text;
    private int startIndex, endIndex, y, height;
    public ColumnGroup(String text, int startIndex, int endIndex) {
    this.text = text;
    this.startIndex = startIndex;
    this.endIndex = endIndex;
    public int getEndIndex() {
    return endIndex;
    public int getHeight() {
    return height;
    public int getLength() {
    return endIndex - startIndex;
    public int getStartIndex() {
    return startIndex;
    public String getText() {
    return text;
    public int getY() {
    return y;
    public void setHeight(int height) {
    this.height = height;
    public void setY(int y) {
    this.y = y;

  • JMenu and Paint Problem

    Hello,
    I have been teaching my self Java and I have become quite proficient with it, however, I have a problem that I can not fix, or get around.
    I have a JMenuBar in a JFrame with some JMenu�s containing JMenuItems. I also have a JPanel that I draw inside (I Know that is probably not the wisest way to draw things, but it was the way I first learned to draw and now my program is too big and it is not worth while to change). Any ways, I draw some graphics inside of this JPanel.
    The menu items change the drawings; this is done by repainting the JPanel Graphic. However, when I click one of the menu items, the JPanel paints but there is a residual of the JMenu in the background that will not disappear.
    The menu is closed and if I open and then close the menu the residual goes away.
    => I would like to know how to prevent the residual from appearing?
    The problem also occurs when I use the popup menus outside of the JmenuBar.
    What I think is wrong.
    I think my problem is with the repaint. I don�t think the JFrame is repainting. I think I am simply repainting all the components in the JFrame but not the JFrame itself and thus the residual is not cleared from the JFrame. I don�t know how to fix this but I believe that is the problem because when I minimize the JFrame then Maximize it the JFrame will not paint, and I can see right through the JFrame, but the components paint fine.
    Sorry for the long question, but I don�t know what would be helpful.
    Any advice would be appreciated,
    Thank you
    Seraj

    // This is the code that listens for the menu item
    private void RBmmActionPerformed(java.awt.event.ActionEvent evt) {                                    
            calc.setIN(false);
            updateData();                    // updates some data
            paint2();                           // my special draw fuction shown below
        public void paint2()                          // this the special paint that draws on the JPanel
            Graphics page = jPanel1.getGraphics();
            if(start_end)
                myPic.draw(page);
            else
                page.setColor(Color.WHITE);
                page.fillRect((int)(OFFSET.getX()), (int)(OFFSET.getY()), (int)(R_BOUND-OFFSET.getX()), (int)(L_BOUND-OFFSET.getY()));
            repaint();             
    public void paint(Graphics g)               // this is the regular paint methode
            MessageHandler();
            ATD_age.repaint();
            StanderdCal.repaint();
            ChildSRF.repaint();
            MessageArea.repaint();
        }I hope that is helpful

Maybe you are looking for