GTK ComboBoxText错误

时间:2015-03-05 23:59:05

标签: java gtk3 glade

我试图使用使用Glade创建的ComboBoxText,但它引发了以下错误:

public static void main(String[] args) throws FileNotFoundException, ParseException {
    Gtk.init(null);
    Builder b = new Builder();
    b.addFromFile("resources/TestComboBox.glade");
    Window window = (Window) b.getObject("window");
    ComboBoxText comboBoxText = (ComboBoxText) b.getObject("combo");
    window.showAll();
    Gtk.main();
}

提出以下错误

DANGER: (null)-CRITICAL, Constructor methodID not found
Exception in thread "main" java.lang.NoSuchMethodError: <init>
at org.freedesktop.bindings.Plumbing.createPointer(Native Method)

我的林间空地文件

<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk+" version="3.12"/>
  <object class="GtkWindow" id="window">
    <property name="width_request">100</property>
    <property name="can_focus">False</property>
    <child>
      <object class="GtkBox" id="box1">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkComboBoxText" id="combo">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>

我可以通过替换第6行及其作品来手动创建我的ComboBoxText

Box box = (Box) b.getObject("box");
ComboBoxText combo = new ComboBoxText();
combo.appendText("SYD");
box.add(combo);

导致此错误的原因是什么,我该如何解决?

0 个答案:

没有答案