String hid = (String) jc.getClientProperty("HelpID"); // NOI18N
public void actionPerformed(ActionEvent ae) { Token token = (Token) ((JComponent) ae.getSource()).getClientProperty("token"); if (token.getType() == Token.EOF_TYPE) { scriptPane.select(0, 0); return; } try { int start = scriptPane.getLineStartOffset(token.getLine() - 1) + token.getColumn() - 1; scriptPane.select(start, start + token.getText().length()); scriptPane.requestFocus(); } catch (BadLocationException ex) { // IGNORE } }
/** Tryes to get dimension of wizard panel's left pane from getProperty() * if doesn't succeed then tryes at * supplied <CODE>JComponent</CODE>s client property. * @return <CODE>Dimension</CODE> dimension of wizard panel's left pane */ private Dimension getLeftDimension(JComponent c) { Dimension leftDimension; Object property = c.getClientProperty(PROP_LEFT_DIMENSION); if (property instanceof Dimension) { leftDimension = (Dimension) property; } else { leftDimension = new Dimension(198, 233); } return leftDimension; }
@Override public void actionPerformed(ActionEvent actionEvent) { String filePath = (String) ((JComponent) actionEvent.getSource()).getClientProperty("path"); try { readPDFFile(filePath, ""); } catch (Exception e) { throw new RuntimeException(e); } } };
static void prepareMenuBridgeItemsInContainer(Container c) { Component[] comps = c.getComponents(); for (int i = 0; i < comps.length; i++) { if (comps[i] instanceof JComponent) { JComponent cop = (JComponent) comps[i]; MenuBridge bridge = (MenuBridge) cop.getClientProperty("menubridgeresizehack"); if (bridge != null) { bridge.updateState(null); } } } }
/** Tryes to get property from getProperty() if doesn't succeed then tryes at * supplied <CODE>JComponent</CODE>s client property. * @param c origin of property * @param s name of property * @return boolean property */ private boolean getBooleanProperty(JComponent c, String s) { Object property = getProperty(s); if (property instanceof Boolean) { return ((Boolean) property).booleanValue(); } property = c.getClientProperty(s); if (property instanceof Boolean) { return ((Boolean) property).booleanValue(); } return false; }
/** * Paints the border for the specified component with the specified * position and size. */ @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { // Fix #7497, Fix #8247, Fix #8332: BufImgSurfaceData cannot be cast to XRSurfaceData on drawImage() try { // fake drop shadow effect in case of heavy weight popups JComponent popup = (JComponent) c; Image hShadowBg = (Image) popup.getClientProperty(ShadowPopupFactory.PROP_HORIZONTAL_BACKGROUND); if (hShadowBg != null) { g.drawImage(hShadowBg, x, y + height - 5, c); } Image vShadowBg = (Image) popup.getClientProperty(ShadowPopupFactory.PROP_VERTICAL_BACKGROUND); if (vShadowBg != null) { g.drawImage(vShadowBg, x + width - 5, y, c); } // draw drop shadow g.drawImage(shadow, x + 5, y + height - 5, x + 10, y + height, 0, 6, 5, 11, null, c); g.drawImage(shadow, x + 10, y + height - 5, x + width - 5, y + height, 5, 6, 6, 11, null, c); g.drawImage(shadow, x + width - 5, y + 5, x + width, y + 10, 6, 0, 11, 5, null, c); g.drawImage(shadow, x + width - 5, y + 10, x + width, y + height - 5, 6, 5, 11, 6, null, c); g.drawImage(shadow, x + width - 5, y + height - 5, x + width, y + height, 6, 6, 11, 11, null, c); } catch (ClassCastException e) { LOGGER.error(e.getMessage(), e); } }
public void stateChanged(ChangeEvent e) { JComponent component = (JComponent) e.getSource(); TestbedSetting setting = (TestbedSetting) component.getClientProperty(SETTING_TAG); switch (setting.constraintType) { case BOOLEAN: JCheckBox box = (JCheckBox) e.getSource(); setting.enabled = box.isSelected(); break; case RANGE: JSlider slider = (JSlider) e.getSource(); setting.value = slider.getValue(); JLabel label = (JLabel) slider.getClientProperty(LABEL_TAG); label.setText(setting.name + ": " + setting.value); break; } model.getPanel().grabFocus(); }
Object qso = component.getClientProperty(CLIENT_PROPERTY_KEY); if (qso instanceof QuickSearch) { throw new IllegalStateException("A quick search is attached to this component already, detach it first."); // NOI18N
String hid = (String) jc.getClientProperty("HelpID"); // NOI18N
contentSelectedIndex = ((Integer) property).intValue(); } else { property = c.getClientProperty(PROP_CONTENT_SELECTED_INDEX); contentData = (String[]) property; } else { property = c.getClientProperty(PROP_CONTENT_DATA); image = (Image) property; } else if ((properties == null) || (!properties.containsKey(PROP_IMAGE))) { property = c.getClientProperty(PROP_IMAGE); imageAlignment = (String) property; } else { property = c.getClientProperty(PROP_IMAGE_ALIGNMENT); contentBackColor = (Color) property; } else { property = c.getClientProperty(PROP_CONTENT_BACK_COLOR); contentForegroundColor = (Color) property; } else { property = c.getClientProperty(PROP_CONTENT_FOREGROUND_COLOR); property = c.getClientProperty(PROP_HELP_URL);
&& Boolean.TRUE.equals(((JComponent) comps[0]).getClientProperty(PROP_DRAGGER))) { visibleButtons = 1; // always include the dragger if present
private ExternalResource getModel(final MouseEvent e) { final JComponent component = (JComponent) e.getComponent(); final ExternalResource model = (ExternalResource) component.getClientProperty(ExternalResource.class); return model; }
protected static boolean isActive(JComponent jcomponent) { if (jcomponent == null) return true; Object obj = jcomponent.getClientProperty("Frame.active"); return !Boolean.FALSE.equals(obj); }
/** * Find the currently in use tabbed container, if any */ private JComponent findTabbedContainer() { Component[] c = getComponents(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof JComponent && Boolean.TRUE.equals(((JComponent) c[i]).getClientProperty("tc"))) { return (JComponent) c[i]; } } return null; }
public void actionPerformed(ActionEvent e) { final JComponent mapViewComponent = getMapViewComponent(); if(mapViewComponent != null) { final Boolean value = Boolean.TRUE.equals(mapViewComponent.getClientProperty(propertyName)); boolean newValue = ! value.booleanValue(); mapViewComponent.putClientProperty(propertyName, newValue); setSelected(newValue); } }
/** * Register a child of a JScrollPane (only JList or JTree supported * for now) which should show helper tooltips. Should be called * from the component's addNotify() method. */ synchronized static void register (JComponent comp) { ViewTooltips vtt = (ViewTooltips) comp.getClientProperty(KEY); assert vtt == null : "There already is " + vtt + " for " + comp; comp.putClientProperty(KEY, vtt = new ViewTooltips()); vtt.attachTo (comp); }
public void readSettings(Object settings) { wizardDescriptor = (WizardDescriptor)settings; component.read (wizardDescriptor); // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title // this name is used in NewProjectWizard to modify the title Object substitute = ((JComponent)component).getClientProperty ("NewProjectWizard_Title"); // NOI18N if (substitute != null) { wizardDescriptor.putProperty ("NewProjectWizard_Title", substitute); // NOI18N } }
@Override protected void applyForeground(Component renderer, ComponentAdapter adapter) { if (!adapter.isSelected()) { Object colorMemory = ((JComponent) renderer).getClientProperty("rendererColorMemory.foreground"); if (colorMemory instanceof ColorMemory) { renderer.setForeground(((ColorMemory) colorMemory).color); } else { ((JComponent) renderer).putClientProperty("rendererColorMemory.foreground", new ColorMemory(renderer.getForeground())); } } }
@Override public Dimension getMaximumSize(JComponent c) { Dimension d = getPreferredSize(c); View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); } return d; }