don't claim that the way I did is the best. I'd love to see other answ translation - don't claim that the way I did is the best. I'd love to see other answ Indonesian how to say

don't claim that the way I did is t

don't claim that the way I did is the best. I'd love to see other answer with, let's say, all view done with MigLayout. It would be very instructive. I was learning Swing GUI when Sun's implementation were only one so it prevailed in my style. That said, I recommend consulting Sun's Swing GUI short course. It also includes a simple study case. After reading it almost whole part of SudokuView should be clear.

I did separate the code to make it more readable. That's why controller is another class, not part of view. The view is only for construction of widgets and layout, but to make it simple (not to create few more classes) I also initialize controller in it.

The real work is in the controller. It contains the hairiest details... Threading also goes there so it's not so obvious what it actually does. I implemented a Thread class from scratch. There is alternative: using SwingWorker. It might be a cliche, but make it clear: I use threading to make GUI responsive at any time. Without proper threading whole GUI would freeze when the computation would take place. I decided to make it as easy as possible from Sudoku's implementation point of view, like non-blocking incremental updates.

As for threading it's crucial to know which code runs in which thread. Every action fired by GUI component runs on EDT (event dispatch thread). If you do any long-running task on it, the GUI won't be responsive. So I just make another thread (see implementation of goButtonPressed()) and start it. After that EDT can process any other events without blocking.

So Your Sudoku runs in a special, background thread. It can do whatever it wants, unless it has to update the GUI. It almost certain it will, since that's where partial updates go. Here's a catch: if You call any GUI component directly (set some values) than the GUI will freeze. This is a condition called EDT dispatch violation. All interaction with Swing should be done on EDT to avoid any freezes. How to do it? The EDT has special event queue just for that. You post an update event on the queue. On EDT code is constantly watching for incoming events and updates GUI accordingly. So basically, it's a communication between background thread and EDT. To post an event on the queue You could use special utility method designed just for this: EventQueue.invokeLater(new Runnable() { /* here goes your GUI interaction */ });. Take a look at SudokuController methods:

setSudokuResult()
public void setSudokuTime()
setSudokuCompleted()

That's were the GUI update events are posted.
0/5000
From: -
To: -
Results (Indonesian) 1: [Copy]
Copied!
tidak mengklaim bahwa cara saya lakukan adalah yang terbaik. Saya akan senang melihat jawaban lain dengan, mari kita mengatakan, semua pemandangan yang dilakukan dengan MigLayout. Ini akan menjadi sangat instruktif. Saya belajar Swing GUI ketika matahari implementasi hanya satu sehingga ia berlaku dalam gaya saya. Yang mengatakan, saya sarankan konsultasi kursus singkat ayunan GUI matahari. Ini juga mencakup sederhana studi kasus. Setelah membaca itu hampir seluruh bagian dari SudokuView harus jelas.Saya melakukan memisahkan kode untuk membuatnya lebih mudah dibaca. Itu sebabnya controller adalah kelas lain, bukan bagian dari pemandangan. Pandangan hanya untuk pembangunan widget dan tata letak, tetapi untuk membuatnya sederhana (tidak untuk membuat beberapa lebih kelas) saya juga menginisialisasi controller di dalamnya.Pekerjaan yang sebenarnya adalah di controller. Ini berisi rincian hairiest... Threading juga pergi ke sana sehingga tidak begitu jelas apa yang sebenarnya tidak. Saya menerapkan kelas Thread dari awal. Ada alternatif: menggunakan SwingWorker. Mungkin menjadi klise, tapi menjelaskan: saya menggunakan threading untuk membuat GUI responsif setiap saat. Tanpa tepat threading seluruh GUI akan membeku ketika perhitungan akan berlangsung. Saya memutuskan untuk membuatnya semudah mungkin dari Sudoku's implementasi sudut pandang, seperti non-blocking update inkremental.Adapun threading sangat penting untuk mengetahui kode yang berjalan di thread yang. Setiap tindakan yang dipecat oleh komponen GUI berjalan pada EDT (acara pengiriman thread). Jika Anda melakukan apapun tugas lama berjalan di atasnya, GUI tidak akan responsif. Jadi aku hanya membuat thread lain (Lihat pelaksanaan goButtonPressed()) dan memulai itu. Setelah itu EDT dapat memproses acara lainnya tanpa menghalangi.Jadi Anda Sudoku berjalan di latar belakang khusus, thread. Dapat melakukan apa pun yang diinginkannya, kecuali memiliki untuk memperbarui GUI. Itu hampir pasti akan, karena itulah parsial pembaruan di mana pergi. Di sini adalah menangkap: jika Anda memanggil setiap komponen GUI langsung (ditetapkan beberapa nilai) dari GUI akan membeku. Ini adalah suatu kondisi yang disebut EDT pengiriman pelanggaran. Semua interaksi dengan ayunan harus dilakukan pada EDT untuk menghindari membeku apapun. Bagaimana cara melakukannya? EDT memiliki antrian acara khusus hanya untuk itu. Anda memposting pembaruan acara di antrian. Pada EDT kode terus-menerus mengawasi untuk kejadian masuk dan update GUI sesuai. Jadi pada dasarnya, ini adalah komunikasi antara benang latar belakang dan EDT. Untuk mengirim peristiwa pada antrian Anda bisa menggunakan metode utilitas istimewa yang dirancang hanya untuk ini: EventQueue.invokeLater (baru Runnable() {/ * begini interaksi GUI Anda * /});. Lihatlah SudokuController metode: setSudokuResult() Umum setSudokuTime() Batal setSudokuCompleted()Itu adalah peristiwa update GUI yang diposting.
Being translated, please wait..
Results (Indonesian) 2:[Copy]
Copied!
don't claim that the way I did is the best. I'd love to see other answer with, let's say, all view done with MigLayout. It would be very instructive. I was learning Swing GUI when Sun's implementation were only one so it prevailed in my style. That said, I recommend consulting Sun's Swing GUI short course. It also includes a simple study case. After reading it almost whole part of SudokuView should be clear.

I did separate the code to make it more readable. That's why controller is another class, not part of view. The view is only for construction of widgets and layout, but to make it simple (not to create few more classes) I also initialize controller in it.

The real work is in the controller. It contains the hairiest details... Threading also goes there so it's not so obvious what it actually does. I implemented a Thread class from scratch. There is alternative: using SwingWorker. It might be a cliche, but make it clear: I use threading to make GUI responsive at any time. Without proper threading whole GUI would freeze when the computation would take place. I decided to make it as easy as possible from Sudoku's implementation point of view, like non-blocking incremental updates.

As for threading it's crucial to know which code runs in which thread. Every action fired by GUI component runs on EDT (event dispatch thread). If you do any long-running task on it, the GUI won't be responsive. So I just make another thread (see implementation of goButtonPressed()) and start it. After that EDT can process any other events without blocking.

So Your Sudoku runs in a special, background thread. It can do whatever it wants, unless it has to update the GUI. It almost certain it will, since that's where partial updates go. Here's a catch: if You call any GUI component directly (set some values) than the GUI will freeze. This is a condition called EDT dispatch violation. All interaction with Swing should be done on EDT to avoid any freezes. How to do it? The EDT has special event queue just for that. You post an update event on the queue. On EDT code is constantly watching for incoming events and updates GUI accordingly. So basically, it's a communication between background thread and EDT. To post an event on the queue You could use special utility method designed just for this: EventQueue.invokeLater(new Runnable() { /* here goes your GUI interaction */ });. Take a look at SudokuController methods:

setSudokuResult()
public void setSudokuTime()
setSudokuCompleted()

That's were the GUI update events are posted.
Being translated, please wait..
 
Other languages
The translation tool support: Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese, Chinese Traditional, Corsican, Croatian, Czech, Danish, Detect language, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Korean, Kurdish (Kurmanji), Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Odia (Oriya), Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Scots Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Spanish, Sundanese, Swahili, Swedish, Tajik, Tamil, Tatar, Telugu, Thai, Turkish, Turkmen, Ukrainian, Urdu, Uyghur, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu, Language translation.

Copyright ©2025 I Love Translation. All reserved.

E-mail: