Monday, May 19, 2008

Next thing!

I think I'm done with that project (the text field). Essentially every basic text function works now, and I've included confirmation boxes for certain things (ex: when you hit esc, you are asked whether or not you wish to quit the program). The only other thing I could want to do with it would be to allow manipulation of previously entered text (using storage arrays) - but that would probably take more work than what I've already done on this project, and I'm feeling like I want to move on anyway.
Onward to the next project!

Monday, May 5, 2008

more of the same, basically

still working on the keylistener/text field project. Finally got backspace to work by having it replace the previous character with nothing. Had some trouble using that when the previous character was a new line (\n); compromised by telling the new line to fill the line with spaces instead of using \n. It's less convenient, but functional. Next up: working with shift! symbols and capital/lowercase letters will be really useful.

Tuesday, April 15, 2008

Text project progressing

Still working on the text simulation thing, which, again, is meant more to expand my knowledge than to be practical or useful. Newest development: all basic text keys are usable (including letters, numbers, and single-keystroke punctuation and symbols).
I also figured out how to work with a backspace function - it was just simpler than I had expected. The code looks something like:

Switch (keycode) ** which works like an if clause**
{

case KeyEvent VK_BACK_SPACE: **activates when backspace is used**

welcomeJTextArea.replaceRange( **this tells it to replace
"", welcomeJTextArea.getText().length - 1, the text in the previous
welcomeJTextArea.getText().length ); spot with a blank**

blinkx -= 17; **moves the cursor back**
break; **ends the statement**

I also simplified the code that activates for each keystroke by consolidating the "blinkx += 17" statements (which move the cursor forward) into one statement.

Thursday, April 3, 2008

more stuff

currently, i'm experimenting with graphics environments and user interactivity, especially with actionlisteners and keylisteners at the moment. i'm also using timers and the like.

Friday, March 21, 2008

hi, and hi

whoops! i guess it's been a while. I'm currently experimenting with things i've learned so far, especially text type things and timers... hopefully when the program is done it will look something like "old school" computers, with the black background and green lettering.

Tuesday, February 12, 2008

finished, more or less

painting thingy is done, it has all the additions and speed I can/want to give it. I still wish it would run faster (in terms of the circles being drawn with spaces in between), but I can't think of any other way to improve, so I'm calling it done. Yay.

Sunday, February 10, 2008

missed class friday, so...

more of the same work, it's harder because I don't necessarily have all the functions memorized in terms of their syntax. It's going well, though. I giving options for color and size, hopefully without affecting the smoothness of the application.

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.