Gregor Kunc

Greenhorn
+ Follow
since Oct 01, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Gregor Kunc

hi.

Can somebody help me at least with how to start? I have to write mysql database (this is not problem), but problem is how to make this database open in java to write data and to save data to that  file.

Thanks
is it possible to give  a color to double and to "" in ta.setText(ta.getText() + "Datum: " + datum +...)
8 years ago

Campbell Ritchie wrote:Do you need any if‑elses? We believe you will learn better if you find out the information for yourself, so we do all we can to avoid simply giving out solutions. How far have you got with it?



thanks, i found some post which i modified and make it work for my program. I know it is better to find it byyourself, but this code was less complicated and it was easier to work on. Of course I would like to learn but I need good teacher -
8 years ago

Campbell Ritchie wrote:I have just suggested he start at the other end of the process. My post is better because it mentions beer

It doesn't really matter which part you do first, but only do one part at a time, otherwise you will become all confused. If you get the details from text fields first, you can start by using System.out.println to show what the text you have read is.



Jah men. I will try, but this is going to kill me. I thought somebody will be so nice and write this for me . So then I have to use if  , else and other son of a .................
Thanks. I will report how it is going and if I would drink beer then I dont think that....... ah who cares I am going to drink it. Thanks for good idea.
8 years ago

Liutauras Vilda wrote:Is it going to be a text file?

Consider what kind of delimiter you want to use to delimit data written to file. What formatting?

Create some dummy String "vienas du trys keturi penki sesi septyni astuoni devyni desimt" and try to pass it to method and write to a file in the way you want it.



At least I want that data in row is written in same line and another  row in another line... I really dont care if it is txt or any format just that is work.
8 years ago

Liutauras Vilda wrote:

Gregor Kunc wrote:When I fill table or put some data (look attachment for table) then I want this to save to file and read it.

So you'll need I think to get text from the cells and write them to file.

Campbell suggested I see already to go through tutorial and learn how to write data to the file. Have you checked it?
To get text from the cell I think is the easier part.



Problem is I dont know how to get data from this cells. That is problem. Text from textfield etc it is easy to write to file (like data.txt), but this is impossible for me to make it read. If I tell the truth I dont even have any idea how to begin with reading cells. I will go trough tutorial. But I saw so many examples which didnt work. Thanks.
8 years ago

Liutauras Vilda wrote:Apart from the GUI part, I'm totally puzzled what you are trying to achieve. Please explain in simple words what the app is supposed to do. Please don't mention any technical terminology how you're going to do.




Ok. When I fill table or put some data (look attachment for table) then I want this to save to file and read it.
8 years ago

Campbell Ritchie wrote:Welcome to the Ranch

That GUI code shou‍ldnot write anything to a file. You sh6‍ld have a separate class which does the reading and writing. I presume you are familiar with the general IO capabilities of Java®. Can you write code which does the writing separately from the GUI? Start with that and show us it, then consider how to control such code from the GUI.
Don't make the GUI classes into action listeners. Don't use == on Strings (but that is probably not the real problem).




Thanks. Yes this code doesnt write anything, because it wont help if I would put "normal text" writer, because it doesnt save. I attached again a table which I want to write to file. I litterally tried everything to write it in file but I am too st...... to do it. If you know hot to add a button like add new line it would be great too.
8 years ago
Okey. I will explain little bit.

1. Class b3a is because it is part of a much bigger code and I have only here problems to make writer.
2. code is work perfectly for now (no mistake), but this I can fix so that it will be.
3. Yes I have button b3a  because this is part of original code and I wanted that it looks like if it would be actually entire code shown here. That is why it is looking so confusing
4. I hope you can see my attachment, I put printscreen to see the table how it looks like.

Sorry for confusion and mess ( I am not professional) .
8 years ago
Hi. I would like to make this code to be written in file, but it is impossible for me to do it. I tried several solutions and I just couldnt figuered it out.  I deleted actionlistener and bufferwriter so that you have just clean code. You press button "Imenik" and it opens table and this table i want to save with all data and if you can add button add new line I will be even more happy. Thanks for help.





8 years ago