Hallo zusammen,
habe folgenden code, krieg nur die Methode cut nicht darein. (ganz unten)
if(e.getSource() == btnausschneiden)
{
textfeld.cut();
}
Krieg immer die Meldung cannot resolve - method cut()
Muss ich da vllt. was importieren, weil ich ja SimpleGui nutze und das ne Metode aus JTextArea.Components ist ?
Vorschläge immer willkommen !
Gruß
Alles anzeigen
habe folgenden code, krieg nur die Methode cut nicht darein. (ganz unten)
if(e.getSource() == btnausschneiden)
{
textfeld.cut();
}
Krieg immer die Meldung cannot resolve - method cut()
Muss ich da vllt. was importieren, weil ich ja SimpleGui nutze und das ne Metode aus JTextArea.Components ist ?
Vorschläge immer willkommen !
Gruß
Quellcode
- import simpleGui.*;
- import java.awt.Font;
- public class Texteditor extends SFrame
- {
- String pfad = "";
- STextArea textfeld = new STextArea (0, 100, 1000, 400, "", this);
- SButton btnoeffnen = new SButton (2, 2, 40, 30, "open.png","öffnen", this);
- SButton btnspeichern = new SButton (45, 2, 40, 30, "speichern.jpg","speichern", this);
- SButton btnspeichernunter= new SButton (87, 2, 40, 30, "speichernUnter.jpg","speichern unter", this);
- SButton btnneuesDokument = new SButton (132, 2, 40, 30, "neuesDokument.jpg","neues Dokument", this);
- SButton btnkopieren = new SButton (500, 2, 40, 30, "kopieren.jpg","kopieren", this);
- SButton btneinfuegen = new SButton (545, 2, 40, 30, "einfuegen.jpg","einfügen", this);
- SButton btnausschneiden = new SButton (586, 2, 40, 30, "ausschneiden.jpg","ausschneiden", this);
- SButton btnfett = new SButton (2, 60, 40, 30, "bold.jpg","fett", this);
- SButton btnkursiv = new SButton (45, 60, 40, 30, "kursiv.jpg","kursiv", this);
- SButton btnunterstrichen = new SButton (88, 60, 40, 30, "unterstrichen.jpg","unterstreichen", this);
- SButton btnvergroeßern= new SButton (400, 60, 40, 30, "lupePlus.png","vergrößern", this);
- SButton btnverkleinern = new SButton (443, 60, 40, 30, "lupeMinus.png","verkleinern", this);
- SButton btnvorschau = new SButton (586, 60, 40, 30, "vorschau.jpg","Vorschau", this);
- SChoice auswahlSchrift = new SChoice (170, 60, 80, 25, new String[] {"Arial","Andy MT","Courier","Monotype Sorts", "Luxi Sans","Simpsons","Thorndale AMT","URW Chancery L"}, this);
- SChoice auswahlGroeße = new SChoice ( 255, 60, 120, 25, new String[] {"6","8","10","12","13","14","15","16","17","18","19","20","30","40", "50","60","70","80","90","100"}, this);
- SFileChooser oeffnen = new SFileChooser (45, 60, 40, 30, "öffnen", this);
- SFileChooser speichern = new SFileChooser (45, 60, 40, 30, "speichern", this);
- public Texteditor()
- {
- super(645, 500, "Texteditor");
- this.setBounds(0,0,645,500);
- this.setVisible(true);
- this.getContentPane().setBackground(new java.awt.Color(238, 216, 174));
- textfeld.textArea.setBackground(new java.awt.Color(255, 231, 186));
- textfeld.textArea.setLineWrap(true);
- }
- public void actionPerformed(java.awt.event.ActionEvent e)
- {
- if(e.getSource() == btnoeffnen)
- {
- if(textfeld.hasChanged())
- {
- int dialog = SDialog.showYesNoCancelDialog("speichern ?", "Wollen Sie ohen zu speichern ein neues Dokument öffnen",this);
- if(dialog == SDialog.YES_OPTION)
- {
- this.pfad=oeffnen.openDialog();
- textfeld.setText(SFile.readText(this.pfad));
- }
- }
- else
- {
- this.pfad=oeffnen.openDialog();
- textfeld.setText(SFile.readText(this.pfad));
- }
- }
- if(e.getSource() == btnspeichern)
- {
- SFile.saveText(this.pfad, textfeld.getText());
- }
- if(e.getSource() == btnspeichernunter)
- {
- this.pfad=speichern.saveDialog();
- SFile.saveText(this.pfad, textfeld.getText());
- }
- if(e.getSource() == btnneuesDokument)
- {
- int dialog = SDialog.showYesNoCancelDialog("speichern ?", "Wollen Sie ohne zu speichern ein neues Dokument öffnen", this);
- if(dialog == SDialog.YES_OPTION)
- {
- textfeld.setText("");
- pfad="";
- }
- if(dialog == SDialog.NO_OPTION)
- {
- this.pfad = speichern.saveDialog();
- SFile.saveText(this.pfad, textfeld.getText());
- }
- }
- if(e.getSource() == btnfett)
- {
- textfeld.insert("dd");
- }
- if(e.getSource() == btnkopieren)
- {
- SClipboard.setText(textfeld.getSelectedText());
- }
- if(e.getSource() == btneinfuegen)
- {
- textfeld.insert(SClipboard.getText());
- }
- if(e.getSource() == btnausschneiden)
- {
- }
- }
- }