diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/CDControl.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/CDControl.java')
| -rw-r--r-- | NET/worlds/scape/CDControl.java | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/NET/worlds/scape/CDControl.java b/NET/worlds/scape/CDControl.java new file mode 100644 index 0000000..b881b00 --- /dev/null +++ b/NET/worlds/scape/CDControl.java @@ -0,0 +1,88 @@ +package NET.worlds.scape; + +import NET.worlds.console.Console; +import NET.worlds.console.DialogReceiver; +import NET.worlds.console.PolledDialog; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.Window; + +public class CDControl extends PolledDialog { + private Label display; + private Button stopButton = new Button("[]"); + private Button pauseButton = new Button("||"); + private Button playButton = new Button(">"); + private Button prevButton = new Button("|<<"); + private Button nextButton = new Button(">>|"); + private Panel top = new Panel(); + private Panel bottom = new Panel(); + private Checkbox cdBox = new Checkbox(Console.message("Autoplay-CD"), CDAudio.useAutoCDFlag); + private Checkbox midiBox = new Checkbox(Console.message("Autoplay-MIDI"), CDAudio.useMidiFlag); + private String time; + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + + public CDControl(Window parent, DialogReceiver receiver) { + super(parent, receiver, Console.message("Music"), false); + this.display = new Label(this.time = CDAudio.get().getTimeReadout()); + this.setAlignment(1); + this.ready(); + } + + @Override + protected void build() { + this.setLayout(new GridLayout(2, 1)); + this.top.setLayout(new FlowLayout()); + this.top.add(this.display); + this.top.add(this.stopButton); + this.top.add(this.pauseButton); + this.top.add(this.playButton); + this.top.add(this.prevButton); + this.top.add(this.nextButton); + this.bottom.setLayout(new GridLayout(2, 1)); + this.cdBox.setFont(font); + this.midiBox.setFont(font); + this.bottom.add(this.cdBox); + this.bottom.add(this.midiBox); + this.add(this.top); + this.add(this.bottom); + } + + @Override + protected void activeCallback() { + String tmp = CDAudio.get().getTimeReadout(); + if (!tmp.equals(this.time)) { + this.display.setText(this.time = tmp); + } + } + + @Override + public boolean action(java.awt.Event event, Object what) { + Object target = event.target; + if (target == this.stopButton) { + CDAudio.get().stop(); + } else if (target == this.pauseButton) { + CDAudio.get().pause(); + } else if (target == this.playButton) { + CDAudio.get().play(); + } else if (target == this.prevButton) { + CDAudio.get().prev(); + } else if (target == this.nextButton) { + CDAudio.get().next(); + } else if (target == this.cdBox) { + CDAudio.get().useAutoCD(this.cdBox.getState()); + } else { + if (target != this.midiBox) { + return false; + } + + CDAudio.get().setMidiFlag(this.midiBox.getState()); + } + + return true; + } +} |