Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-13-2008, 05:25 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 228
Eku is on a distinguished road
Javapad 2.0
Attach here the Beta Version of Notepad with some Java Features.

Contains Basic Features of a Notepad. Except the Print feature is not yet working. (Can someone send me a printing function =))

Contains Extra Features such as Build, Run, Open-Command Line (Must have java_home and Java declared in the environmental variables) (Works in Windows but not yet tested in other platforms)

Feel free to email me your reactions/proposed feature/Bugs and error.
This is my contribution to the Java Community. =)
Attached Files
File Type: zip Javapad.zip (6.0 KB, 4 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-13-2008, 07:01 AM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
I've tested your program....

Win XP SP3
Im using jdk 6 update 3
bin path already set

Build and Runtime error. why? using Runtime? or JavaCompiler class?

I suggest you shall create a documentation about your program. How should specifically use it, its condition before using it, and EULA ( detailed )...

Not bad, keep it up.....

Here is a simple PrintData Class, it will print a page.

Code:
public class PrintData implements Printable{ private Component data; public PrintData(Component e){ this.data = e; } public void setValue(){ new PrintData(data).initializePrint(); } public void initializePrint(){ PrinterJob proceed = PrinterJob.getPrinterJob(); proceed.setPrintable(this); if(proceed.printDialog()){ try{ proceed.print(); }catch(Exception e){ JOptionPane.showMessageDialog(null,"AN ERROR OCCURED WHILE INITIALIZING PRINTER"); } } } public int print(Graphics g, PageFormat format, int page){ int value = Printable.PAGE_EXISTS; Font pattern = new Font("Arial",Font.PLAIN,10); if(page>0){value = Printable.NO_SUCH_PAGE;} Graphics2D g2D = (Graphics2D)g; g2D.setFont(pattern); g2D.translate(format.getImageableX(),format.getImageableY()); data.setFont(pattern); data.paint(g2D); return value; } }
where Component e should be the source of text ( TextArea for example )
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by sukatoa : 05-13-2008 at 07:08 AM.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-13-2008, 08:36 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 228
Eku is on a distinguished road
WAW thanks a lot. I really appreciate it. =)
I just used the command line in Compiling. Here is the Command i used. i just cut it from the main code. I just invoke the Javac and java commands. One more problem is how do i Handle those errors in compiling. I will read the compilerClass, thanks for informing that, Im still have lots to learn about java. =)

Code:
else if (command.equals("Build")) { try { File filename2 = new File(filename.getAbsolutePath().substring(0,filename.getAbsolutePath().lastIndexOf("."))); String s ="javac -cp \""+ filename2.getAbsolutePath().substring(0, filename2.getAbsolutePath().lastIndexOf("\\"))+"\" \""+ filename2.getAbsolutePath() +".java\""; Runtime.getRuntime().exec(s); JOptionPane.showMessageDialog(this,"Building Succesful"); } catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Building Error");} } else if (command.equals("Run")) { try { File filename3 = new File(filename.getAbsolutePath().substring(0,filename.getAbsolutePath().lastIndexOf("."))); String s ="cmd.exe /k start java -cp \""+ filename3.getAbsolutePath().substring(0, filename3.getAbsolutePath().lastIndexOf("\\")) + "\" "+ filename.getName().substring(0,filename.getName().lastIndexOf(".")); Process process = Runtime.getRuntime().exec(s); BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getInputStream())); JOptionPane.showMessageDialog(this,"Run Succesful"); } catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Run Time Error");} }else if (command.equals("Open Command Line")) { try { Runtime.getRuntime().exec("cmd.exe /k start cd \\");} catch (Exception ex){ System.err.println(ex); JOptionPane.showMessageDialog(this,"Run Time Error");} }

Last edited by Eku : 05-13-2008 at 08:40 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 01:04 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org