[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Tutorial on how to create a simple notepad program in Java
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 42
Thread images: 6
File: Java.png (39 KB, 518x518) Image search: [Google]
Java.png
39 KB, 518x518
Intro CS student here, finals are over, and I'm interested in creating a notepad or text editor with simple functionality over the winter break. Any ideas on where to start? Things that would be interesting to implement? Suggestions or resources are welcome.
>inb4 Google
>inb4 stack overflow
>>
>>51774865
>Things that would be interesting to implement?
RegEx search and replace within all open files. Opening multiple files, goes without saying.
>>
>>51774865
Start with googling JTextArea
>>
>RegEx search and replace within all open files.
I hadn't considered that. Thank you.

Where would I begin as far as resources or videos? We ended the semester without going over GUI or file I/O.
>>
>>51774885
literally already a part of emacs
>>
>literally already a part of emacs
This is more of a way to practice programming over winter break and less so doing something new.
>>
@51774997
>not knowing how to quote on 4chan.org/g/
>>
>>51774865
> Be December 9th
> Finals are over

Yeah right. Do your final project assignment on your own Bub!
>>
>>51775062
http://registrar.olemiss.edu/2014/04/30/fall-2015-2/
>Be this wrong
Next.
>>
>>51775051
I lurk. Fuck you.
>>
>>51774918
Will do!
>>
>>51774865
I've done this before as a personal project.
Some things you might want to bone up on include
file handling
>for opening, closing and saving the text file
exception handling
for when something fucks up
JDialog
>to give feedback when the previously stated occurs.
>>
>>51774865
linting for all major languages at least

tab to auto complete
>>
>>51774865
install gentoo
>>
javax.swing.JOptionPane.showMessageDialog("Fuck nigger on sight", null);
>>
>>51776075
or in vb.net

MsgBox("Fuck nigger on sight")
>>
File: sweating_pepe.jpg (38 KB, 600x568) Image search: [Google]
sweating_pepe.jpg
38 KB, 600x568
>>51774975
>file I/O.
!!!

I get that you don't go over GUI, but you haven't covered file IO one semester in?
>>
>>51776095
If it's a compsci101 class it's likely that they just covered the theoretical stuff and then basic syntax for the language, with console apps and such.
>>
>>51776075
JOptionPane.showMessageDialog("I'll take \"Things you Mother says for $100 Alex!\" ");
>>
>>51774865
>in java
why would I want to have to install and run a bloated runtime for a goddamn text editor?
>>
First semester CS student in Denmark here.
We did gui and file I/O and fucking database normalization. What the fuck is America doing?
>>
>>51776160
>what is qt
>what is gtk
>>
>>51776116
>If it's a compsci101 class it's likely that they just covered the theoretical stuff and then basic syntax for the language, with console apps and such.
I don't expect them to do advanced stuff, but surely they've been taught to use something simple like
Printwriter
and just printing to it?
>>
>>51776181
I took a CompSci1 class one semester because it was free (don't ask) and all we did was visual basic GUI programming. Never did file IO, never did console applications, never even did command line arguments.
>>
File: image.jpg (18 KB, 304x166) Image search: [Google]
image.jpg
18 KB, 304x166
>swing
>not javafx

It's 2002 all over again
>>
File: 1442669041214.jpg (29 KB, 250x188) Image search: [Google]
1442669041214.jpg
29 KB, 250x188
>Program the text editor that is programming the text editor
>>
>Drop out of school
>Make notepad app specifically for niggers
>Make bank
>Live inside giant chocolate flavored twinkie
>>
>>51776290
kinda like how csharp's compiler is written in csharp

like lol how do they add new features ?
>>
>>51776301
It's pretty common
>https://en.wikipedia.org/wiki/Self-hosting
>>
ai papi
>>
>>51774865
Someone from my class is doing this right now, it might be you L.T. :)
>>
File: disappoint.jpg (48 KB, 500x524) Image search: [Google]
disappoint.jpg
48 KB, 500x524
>>51776271
This.

Just make an Android app instead. You'll thank yourself later. Or even better a web app. No one uses swing in the real (business) world.
>>
>>51774865
I once was stuck on a rediculously locked down Mac; no applications except those on a whitelist could run. File browser wasn't on the list, but terminal was.

Java was too, and Javac was installed. So, I painstakingly put together a text editor using echo to create a Swing text area. Then, I wrote my text in that, and copy/pasted it into the terminal where I saved it with echo.

There was probably a better way, but IDGAF, it was fun.
>>
>>51778433
>No one uses swing in the real (business) world
The fuck? Yes we do. All the time. Where do you think the GUIs on technician software comes from? You think we're writing fucking web apps to do diagnostics and configuration on a piece of industrial equipment?
>>
File: kek.png (102 KB, 237x248) Image search: [Google]
kek.png
102 KB, 237x248
>>51779225
> Implying diagnostics for industrial equipment even have a GUI.
OK maybe some but with the internet of things approaching yes those "fucking web apps" will do diagnostics. And I'm sure you can even use an app, Android or iOS, to do it as well.
>>
>>51774865
Here's how you do it in C

#include <stdio.h>
int main(void)
{
system("notepad.exe");
return 0;
}
>>
With Java and Swing you can whip something up pretty quickly. I remember attempting something similar (literally just text that I could load/save with a menubar and junk) and it was straightforward as hell.

You can obviously do more advanced junk but the basics are easy enough so go for it.
>>
>>51779353
>with the internet of things
True. Internet (or, more commonly, intranet) connectivity does provide a convienent way to do diagnostics and configuration remotely...

Among your entire fleet as a whole. In fact, in every system I've worked on since my first internship, the units ARE administered remotely with a web app. But individual machines need individual attention sometimes, and technicians can't do their job if they can't stick their head into the software. We the developers thus need to provide the tools they need to do this, and since everyone involved is on the clock, pretty web apps built in Niggertits.js by teams where titles that end in Designer outnumber those who end in Engineer aren't on the menu.

Bare bones applications that run on company Thinkpads that run OpenSuse, on the other hand, are. I don't expect you to know this, because you've never worked with industrial machinery. Want to know how I know this?

> I'm sure you can even use an app, Android or iOS, to do it as well.
That's how.
>>
>>51779486
Obviously the administration through a web app is not 100%. There's a difference between what a (software) developer and a (mechanical) engineer can do. I am a little sad NiggerTits.js is not a real framework though.
>>
Read the fucking gang of four book(aka "Design Patterns: Elements of Reusable Object-Oriented Software") you fagget, example/case-study project is a text editor and you should've read it anyway if you trying to learn java.
>>
People are still using Swing? OP, do yourself a favor and learn JavaFX. It's a lot easier to use, doesn't have the repaint() bullshit, and looks a lot nicer too.
>>
>>51774865
Look into Java's Swing. It's the GUI shit for Java. Pretty much add a JFrame and a multi line text box. Now you can write stuff in textbox. Now look into writing files to directories.
Thread replies: 42
Thread images: 6

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.