1-) Java - TEXTFİELD DAKİ ELEMANLARI COMBOBOX A EKLEME
public class Ikinci extends javax.swing.JFrame {
ArrayList textList = new ArrayList<>(); // eleman sayısı dinamik olan yapılar için ArrayList şiddetle tavsiye edilir. :)
public Ikinci() {
initComponents(); textList.add(jTextField1); textList.add(jTextField2); textList.add(jTextField3);
textList.add(jTextField4); textList.add(jTextField5); }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { //TEXTFİELDLARI TEMİZLER
for(int j=0;j
textList.get(j).setText(""); } }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
boolean control=true;
for(int i=0;i
if(!textList.get(i).getText().equals("")) {
jComboBox1.addItem(textList.get(i).getText()); }
else {control=false;} }
if(!control)
JOptionPane.showMessageDialog(rootPane, "Please check content of TextFields \nSeveral/One of them was/were not added to combobox", "Null Text Warning", WIDTH);