Here you can find the source of isCbEquals(JComboBox cb, String str)
public static boolean isCbEquals(JComboBox cb, String str)
//package com.java2s; /*//from www .j av a 2s .c o m * SbApp: Open Source software for novelists and authors. * Original idea 2008 - 2012 Martin Mustun * Copyrigth (C) Favdb * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ import javax.swing.JComboBox; public class Main { public static boolean isCbEquals(JComboBox cb, String str) { if (cb.getSelectedIndex() == -1) { if (str.equals("")) { return (true); } } else { if (str.equals("")) { return (false); } if (cb.getSelectedItem().equals(str)) { return (true); } } return (false); } }