Tuesday, January 29, 2008

Jan 29

Painter application is now up and running, it just needs polishing. I created a class to draw a circle, then had my main "paint panel" class call the "circle" class whenever the mouse was used (this creates the effect of drawing lines). I also used an ArrayList to store all previously drawn circles, so the application can quickly redraw all of them whenever it needs to.

Sunday, January 27, 2008

immediately after the last post, i found the problem... it was in the code for myDrawJPanel. I should be able to fix it pretty easily.

Jan 27

I missed class on Friday, so today I spent a while messing with Java, trying to get a "paint" style application I'm building to do what I want it to. Specifically, I'm attempting to allow the user to have options like brush size and color. I am also having some problems with one bit of code; for some reason I can't get the drawing panel to have a different background from the main frame.

public void createUserInterface()
{
// get content pane for attaching GUI components
Container contentPane = getContentPane();

// enable explicit positioning of GUI components
contentPane.setLayout( null );
contentPane.setBackground(Color.BLACK);

// set up myDrawJPanel
myDrawJPanel = new DrawJPanel2();
myDrawJPanel.setBounds( 150, 8, 350, 274 );
myDrawJPanel.setBackground(Color.WHITE);
contentPane.add( myDrawJPanel );

// set properties of application's window
setTitle( "Painter" ); // set title bar text
setSize( 516, 330 ); // set window size
setVisible( true ); // display window

} // end method createUserInterface

As far as I know, this should give a black window with a white panel to the right side, but the panel is black too. Oh well.

Thursday, January 24, 2008

New Blog

Today, I created this blog.