paintcomponent Programming Software Development by shwetha_cs26 … class pan extends JPanel { Graphics g; public void paintComponent(Graphics g) { super.paintComponent(g); Color col1=jc.getColor(); g.setColor(col1); g… Re: paintcomponent Programming Software Development by shwetha_cs26 … class pan extends JPanel { Graphics g; public void paintComponent(Graphics g) { super.paintComponent(g); Color col1=jc.getColor(); g.setColor(col1); g… Re: paintcomponent Programming Software Development by shwetha_cs26 … class pan extends JPanel { Graphics g; public void paintComponent(Graphics g) { super.paintComponent(g); Color col1=jc.getColor(); g.setColor(col1); g… paintComponent() and repaint() Programming Software Development by curtissumpter … section I need help with is small. It is the paintComponent section. It is a multi-threaded application and if you…. [code=java] public void updatePicture() { repaint(); } public void paintComponent(Graphics g) { super.paintComponent(g); //System.err.println("Inside paint method outside… paintComponent() Problem Programming Software Development by Tellalca … that all the drawing is done by a single function paintComponent() from the JPanel that I should add to the JFrame…;circle". [CODE]class MyPanel extends JPanel { @Override public void paintComponent(Graphics g)//This function always does the same, no interaction… Re: paintComponent() Problem Programming Software Development by JamesCherrill … hold the info needed to do all the work in paintComponent, or they may just be a list of objects that… have their own paint methods that can be called from paintComponent to delegate the work. Those 2 options pretty much cover… paintComponent() output error.. Programming Software Development by janfritz …, i add a System.out.println("") inside my paintComponent function and i noticed that it printed multiple times (increasing…; " + x2+ " " + y2+ " "); } @Override protected void paintComponent(Graphics g) { System.out.println("entered paint"); Graphics2D… paintComponent error Programming Software Development by game06 … method ***/ public class Display extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); player_class.paint(g); }/** end of paint component method… Re: paintComponent() Problem Programming Software Development by JamesCherrill Add some instance variables to your class (eg a list of shapes, colours, positions ...). Add some public methods to set those variables. Use the variables in paintComponent method to control what/where/how you paint Re: paintComponent() output error.. Programming Software Development by mKorbel [URL="http://stackoverflow.com/questions/8955663/paintcomponent-output-error"]crossposted[/URL] Re: paintcomponent Programming Software Development by Alex Edwards You need to have references to your "pan" class in the global field scope. From there, after your JFrame is instantiated, make a call to the "pan" classes repaint method in your actionListener. From there your button should call paint. All you need to do from there is make the pan class paint a line on the screen when this… Re: paintcomponent Programming Software Development by shwetha_cs26 no sir i could not get u ,,,,,,,,,,can u modify my code n post it Re: paintcomponent Programming Software Development by Alex Edwards [QUOTE=shwetha_cs26;657620]no sir i could not get u ,,,,,,,,,,can u modify my code n post it[/QUOTE] I'll make the modification if you first place your code in code tags. Re: paintcomponent Programming Software Development by shwetha_cs26 tried but geting nuu pointer exception Re: paintcomponent Programming Software Development by shwetha_cs26 ya,,,,,i"ll write code tags....next when i post the code...now its very urgent,,,,need show this code 2day plz,,modify Re: paintcomponent Programming Software Development by VernonDozier [QUOTE=shwetha_cs26;657620]no sir i could not get u ,,,,,,,,,,can u modify my code n post it[/QUOTE] Excellent way to get everyone mad at you and not get any more help. This sentence suggests that you expect others to put in more effort than you are willing to to solve YOUR assignment. You don't explain what you didn't understand about Alex's… Re: paintcomponent Programming Software Development by shwetha_cs26 o plz...am srtuggling here......... to modify my code....no if u help i can understand my problem....anyways am not asking othersput efforts,,,,,,coz from 3days am struggling with this prob and seriously want to know where am wrong...am trying to code according to suugestion given by alex,,,but ending up with null ponter exception Re: paintcomponent Programming Software Development by VernonDozier [QUOTE=shwetha_cs26;657663]o plz...am srtuggling here......... to modify my code....no if u help i can understand my problem....anyways am not asking othersput efforts,,,,,,coz from 3days am struggling with this prob and seriously want to know where am wrong...am trying to code according to suugestion given by alex,,,but ending up with null … Re: paintcomponent Programming Software Development by javaAddict At the line where you get the NullPointerException you are probably trying to use an object that is null and instantiated. See what the message says and you will find which object is that. Then instantiated correctly based on what is the object Re: paintcomponent Programming Software Development by javaAddict And no one is going to read you entire code, to find one single mistake, when you can simply post the line and the message you get from the console. Re: paintcomponent Programming Software Development by shwetha_cs26 Z:\Program Files\Java\jdk1.6.0\bin>java proj Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at proj.actionPerformed(proj.java:111) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19 95) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav a:… Re: paintcomponent Programming Software Development by javaAddict First of all we cannot count 111 lines. Post the part of the code that is around line 111, stating which one is line 111. Also there is a symbol: '#' above this posting form. Press it. Then in the first tag add this: =JAVA, no empty spaces. Then post your code between these tags Re: paintcomponent Programming Software Development by javaAddict And where do you get the error, because at line 111 I see only: [CODE]public static void main(String[]args)[/CODE] And besides if you look at the code: [CODE] public void actionPerformed(ActionEvent e) { if((JButton)e.getSource() == j) { /*jc1 = new JColorChooser(); JColorChooser.showDialog(jp4,"Select The Color", Color.red); c2=… Re: paintcomponent Programming Software Development by VernonDozier As Java Addict mentioned, we can't run it without the f class. You took his "No empty spaces" too literally. Don't put that in the brackets. What he meant was that you did something like this before: [noparse] [ code = JAVA ] // paste code here [/code] rather than this: [code=JAVA] // paste code here [/code] [/noparse]… HELP!!: paintComponent (Graphics g) is called, however it will not draw the commands! Programming Software Development by arash_khazaei …65); playingRock.setHeight (60); game.changeView (); game.paintComponent (getGraphics ()); firstImage = false; secondChanges (playingRock); … and displays the distance. //----------------------------------------------------------------- public void paintComponent (Graphics page) { if (page == … Re: HELP!!: paintComponent (Graphics g) is called, however it will not draw the commands! Programming Software Development by masijade You should not be calling "paintComponent" directly. You should be calling validate() and/or repaint() on the component. Re: Who calls paintComponent() Programming Software Development by harsh2327 …. What you are doing is OVERRIDING paintComponent() of JPanel. So, when paintComponent() is called, your overridden method(that…quot;super(g)", the paintComponent() in JPanel class is called and the original paintComponent() method is also executed.… code which is already written in paintComponent() of JPanel class. Hope you got it now… Is it possible to start this special thread in paintComponent() method ? Programming Software Development by mgdz …(genKernel!=null){ genKernel=null; } } public void paintComponent(Graphics g) { super.paintComponent(g); g2D = (Graphics2D) g; g2D.setColor(… method for g2D object here ? and thread strted in paintComponent() method? :rolleyes: [/U] fnx1 = fnx; fny1… How can I call paintComponent within PanelC4 in my code? And what else is wrong? Programming Software Development by mastr924 …each time a player makes a move by calling paintComponent but java won't let me. How do…piece, ImageIcon icon, int turn) public void paintComponent(Graphics g) { super.paintComponent(g); JLabel label1=new JLabel(); label1.setIcon(…'s already a piece there."); else paintComponent(Graphics g); } } } [/code] Who calls paintComponent() Programming Software Development by FaMu …swing.JPanel; public class DrawPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth(); int height = getHeight… } [/code] 1- Who calls the method paintComponent() ? 2- What the purpose of super.paintComponent(g) and why there is no difference…