10 changed files with 397 additions and 175 deletions
@ -1,11 +1,30 @@
@@ -1,11 +1,30 @@
|
||||
Actions : Aktionen |
||||
Category : Kategorie |
||||
CATEGORY : KATEGORIE |
||||
Conversion failed. : Konvertierung fehlgeschlagen. |
||||
Converting to PDF… : Kovertiere zu PDF… |
||||
current resolution : aktuelle Auflösung |
||||
DAY : TAG |
||||
height : Höhe |
||||
Directory : Ordner |
||||
display preview : Vorschau anzeigen |
||||
done : fertig |
||||
Error code\: {} for {} : Fehlercode: {} für {} |
||||
Finished text recognition. : Texterkennung beendet. |
||||
Height : Höhe |
||||
Joining PDFs… : Verbinde PDFs… |
||||
join PDFs : PDFs zusammenführen |
||||
MONTH : MONAT |
||||
OCR failed. : OCR fehlgeschlagen. |
||||
open folder : Ordner öffnen |
||||
Path '{}' does not exist! : Pfad '{}' existiert nicht! |
||||
Path : Pfad |
||||
PDFs joined. : Zusammengefügt.: |
||||
Press Shift + Delete to remove an entry. : Drücken Sie Umschalt + Entf um einen Eintrag zu löschen |
||||
scanning… : Scanne… |
||||
width : Breite |
||||
Scan failed. : Scannen fehlgeschlagen. |
||||
Scanning… : Scanne… |
||||
scan! : scannen! |
||||
State : Status |
||||
{} terminated\: : {} abgebrochen: |
||||
Text recognition… : Texterkennung… |
||||
Width : Breite |
||||
YEAR : JAHR |
||||
|
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
December : Dezember |
||||
February : Februar |
||||
January : Januar |
||||
July : Juli |
||||
June : Juni |
||||
March : März |
||||
May : Mai |
||||
October : Oktober |
||||
Su : So |
||||
Th : Do |
||||
Tu : Di |
||||
We : Mi |
@ -1,112 +0,0 @@
@@ -1,112 +0,0 @@
|
||||
package de.srsoftware.belegscanner.gui; |
||||
|
||||
import java.awt.EventQueue; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.awt.event.KeyAdapter; |
||||
import java.awt.event.KeyEvent; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import javax.swing.DefaultComboBoxModel; |
||||
import javax.swing.JComboBox; |
||||
import javax.swing.JFrame; |
||||
import javax.swing.JTextField; |
||||
import javax.swing.SwingUtilities; |
||||
|
||||
public class FilterComboBoxText { |
||||
|
||||
private JFrame frame; |
||||
private final JComboBox<String> comboBox = new JComboBox<>(); |
||||
private static List<String>listForComboBox= new ArrayList<String>(); |
||||
|
||||
/** |
||||
* Launch the application. |
||||
*/ |
||||
public static void main(String[] args) { |
||||
EventQueue.invokeLater(new Runnable() { |
||||
public void run() { |
||||
try { |
||||
FilterComboBoxText window = new FilterComboBoxText(); |
||||
window.frame.setVisible(true); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
listForComboBox.add("Lion"); |
||||
listForComboBox.add("LionKing"); |
||||
listForComboBox.add("Mufasa"); |
||||
listForComboBox.add("Nala"); |
||||
listForComboBox.add("KingNala"); |
||||
listForComboBox.add("Animals"); |
||||
listForComboBox.add("Anims"); |
||||
listForComboBox.add("Fish"); |
||||
listForComboBox.add("Jelly Fish"); |
||||
listForComboBox.add("I am the boss"); |
||||
|
||||
|
||||
} |
||||
|
||||
public FilterComboBoxText() { |
||||
initialize(); |
||||
} |
||||
|
||||
private void initialize() { |
||||
frame = new JFrame(); |
||||
frame.setBounds(100, 100, 412, 165); |
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||
frame.getContentPane().setLayout(null); |
||||
comboBox.setEditable(true); |
||||
|
||||
comboBox.addItemListener(new ItemListener() { |
||||
public void itemStateChanged(ItemEvent arg0) { |
||||
|
||||
} |
||||
}); |
||||
|
||||
for(String detail : listForComboBox) comboBox.addItem(detail); |
||||
final JTextField textfield = (JTextField) comboBox.getEditor().getEditorComponent(); |
||||
textfield.addKeyListener(new KeyAdapter() { |
||||
public void keyReleased(KeyEvent ke) { |
||||
SwingUtilities.invokeLater(new Runnable() { |
||||
public void run() { |
||||
if(!textfield.getText().isEmpty()){ |
||||
comboBoxFilter(textfield.getText()); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
} |
||||
}); |
||||
comboBox.setBounds(10, 39, 364, 29); |
||||
frame.getContentPane().add(comboBox); |
||||
} |
||||
|
||||
public void comboBoxFilter(String enteredText) { |
||||
System.out.println(comboBox.getItemCount()); |
||||
|
||||
if (!comboBox.isPopupVisible()) { |
||||
comboBox.showPopup(); |
||||
} |
||||
|
||||
List<String> filterArray= new ArrayList<String>(); |
||||
for (int i = 0; i < listForComboBox.size(); i++) { |
||||
if (listForComboBox.get(i).toLowerCase().contains(enteredText.toLowerCase())) { |
||||
filterArray.add(listForComboBox.get(i)); |
||||
} |
||||
} |
||||
if (filterArray.size() > 0) { |
||||
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) comboBox.getModel(); |
||||
model.removeAllElements(); |
||||
model.addElement(""); |
||||
for (String s: filterArray) |
||||
model.addElement(s); |
||||
|
||||
JTextField textfield = (JTextField) comboBox.getEditor().getEditorComponent(); |
||||
textfield.setText(enteredText); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue