/** * Merge the infromation from the given <code>.ui</code> file into the current Builder tree. * * @throws ParseException The underlying GtkBuilder library was unable to process the User * Interface description in the given string. * @since 4.0.20 */ public void addFromString(String buffer) throws ParseException { try { GtkBuilder.addFromString(this, buffer, -1); } catch (GlibException e) { throw new ParseException(e.getMessage(), 0); } }
/* * You might regard it as somewhat excessive to test the file here, but * path errors (or rather, assumptions about what the current working * directory is turning out to wildly wrong) are so common that we help * out beginners by guarding. */ public void addFromFile(String filename) throws FileNotFoundException, ParseException { final File target; if (filename == null) { throw new IllegalArgumentException(); } target = new File(filename); if (!target.exists()) { throw new FileNotFoundException( "\nCan't find the specified Glade UI file:\n" + target.getAbsolutePath()); } if (!target.canRead()) { throw new FileNotFoundException( "\nThe specified Glade UI file,\n" + target.getAbsolutePath() + "\nis not readable"); } try { GtkBuilder.addFromFile(this, filename); } catch (GlibException e) { throw new ParseException(e.getMessage(), 0); } }
/** * Creates a new Builder tree. * * @since 4.0.20 */ public Builder() { super(GtkBuilder.createBuilder()); }
/** * Get the Object corresponding to the given name. * * @since 4.0.20 */ public Object getObject(String name) { if (name == null) { throw new IllegalArgumentException(); } return GtkBuilder.getObject(this, name); }