Skip to content

Instantly share code, notes, and snippets.

@ski7777
Last active February 4, 2018 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ski7777/eb017fc91cfc035ab8fb2154563bf00f to your computer and use it in GitHub Desktop.
Save ski7777/eb017fc91cfc035ab8fb2154563bf00f to your computer and use it in GitHub Desktop.
// s is type Sheet
// this is "at musicNotesDatabase.PanelSheets.fillInstrumentList(PanelSheets.java:107)"
SheetInstrument si = (SheetInstrument) s;
package musicNotesDatabase;
import java.util.UUID;
class Sheet {
private int instrument;
private UUID uuid;
public Sheet(int instrument, UUID uuid) {
this.instrument = instrument;
this.uuid = uuid;
}
public int getInstrumentId() {
return instrument;
}
public UUID getPDFUUID() {
return uuid;
}
public String toString() {
return null;
}
}
package musicNotesDatabase;
import java.sql.SQLException;
import java.util.UUID;
public class SheetInstrument extends Sheet {
private String InstrumentName;
public SheetInstrument(int instrument, UUID uuid) {
super(instrument, uuid);
}
public void setInstrumentName(Database db, String lang) throws SQLException {
InstrumentName = db.getInstrumentName(getInstrumentId(), lang);
}
public String getInstrumentName() {
return InstrumentName;
}
}
Exception in thread "AWT-EventQueue-1" java.lang.ClassCastException: musicNotesDatabase.Sheet cannot be cast to musicNotesDatabase.SheetInstrument
at musicNotesDatabase.PanelSheets.fillInstrumentList(PanelSheets.java:107)
at musicNotesDatabase.PanelSheets.onCompositionSelect(PanelSheets.java:93)
at musicNotesDatabase.PanelSheets.lambda$1(PanelSheets.java:59)
at javax.swing.JList.fireSelectionValueChanged(JList.java:1796)
at javax.swing.JList$ListSelectionHandler.valueChanged(JList.java:1810)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:154)
at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelectionModel.java:685)
at javax.swing.JList.setValueIsAdjusting(JList.java:2140)
at javax.swing.plaf.basic.BasicListUI$Handler.mouseReleased(BasicListUI.java:2796)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment