List of usage examples for javax.swing JLabel getParent
public Container getParent()
From source file:client.InterfaceJeu.java
public void nettoyerMain() { try {//from w ww . j a v a 2 s . c o m Iterator it = imgCartes.iterator(); while (it.hasNext()) { JLabel aux = (JLabel) it.next(); aux.getParent().remove(aux); } imgCartes.clear(); jPanel1.repaint(); } catch (Exception e) { System.out.println("erreur nettoyage main : " + e.getMessage()); } }
From source file:client.InterfaceJeu.java
public void nettoyerTable() { try {//ww w . j av a2 s.c o m Iterator it = imgCartesPosees.iterator(); while (it.hasNext()) { JLabel aux = (JLabel) it.next(); aux.getParent().remove(aux); } imgCartesPosees.clear(); } catch (Exception e) { System.out.println("erreur nettoyage table : " + e.getMessage()); } jPanel2.repaint(); }
From source file:self.philbrown.javaQuery.$.java
/** * Include the html string the selected views. If a view has a setText method, it is used. Otherwise, * a new TextView is created. This html can also handle image tags for both urls and local files. * Local files should be the name (for example, for R.id.ic_launcher, just use ic_launcher). * @param html the HTML String to include *//*from ww w .j a v a 2s. c o m*/ public $ html(String html) { for (Component view : this.views) { try { Method m = view.getClass().getMethod("setText", new Class<?>[] { String.class }); m.invoke(view, html); } catch (Throwable t) { if (view instanceof Container) { try { //no setText method. Try a TextView JLabel label = new JLabel(); int rgba = Color.HSBtoRGB(0, 0, 0); rgba |= (0 & 0xff); label.setBackground(new Color(rgba, true)); label.setBounds(label.getParent().getBounds()); ((Container) view).add(label); label.setText(html); } catch (Throwable t2) { //unable to set content Log.w("javaQuery", "unable to set HTML content"); } } else { //unable to set content Log.w("javaQuery", "unable to set textual content"); } } } return this; }
From source file:self.philbrown.javaQuery.$.java
/** * Includes the given text string inside of the selected views. If a view has a setText method, it is used * otherwise, if possible, a textview is added as a child to display the text. * @param text the text to include// w ww . j a v a2 s.com */ public $ text(String text) { for (Component view : this.views) { try { Method m = view.getClass().getMethod("setText", new Class<?>[] { String.class }); m.invoke(view, text); } catch (Throwable t) { if (view instanceof Container) { try { //no setText method. Try a TextView JLabel label = new JLabel(); int rgba = Color.HSBtoRGB(0, 0, 0); rgba |= (0 & 0xff); label.setBackground(new Color(rgba, true)); label.setBounds(label.getParent().getBounds()); ((Container) view).add(label); label.setText(text); } catch (Throwable t2) { //unable to set content Log.w("javaQuery", "unable to set textual content"); } } else { //unable to set content Log.w("javaQuery", "unable to set textual content"); } } } return this; }