示例#1
0
 //	private ColorDrawable nullDrabable = new ColorDrawable();
 @SuppressLint("NewApi")
 public void setActivate(boolean activate) {
   this.activate = activate;
   if (!isInited) {
     return;
   }
   if (activate) {
     if (this.activateBackground != null) {
       super.setBackground(activateBackground);
     }
     if (this.activateIcon != null && image != null) {
       image.setImageDrawable(activateIcon);
     }
     if (this.overlayView != null) {
       overlayView.setBackgroundDrawable(null);
     }
   } else {
     // if(this.background != null){
     super.setBackground(background);
     // }
     if (image != null) {
       image.setImageDrawable(icon);
     }
     if (this.overlayView != null) {
       overlayView.setBackgroundDrawable(overlayDrawable);
     }
   }
 }
 @Override
 protected void initListeners() {
   super.initListeners();
   filenameButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           File defaultFile = new File(filenameButton.getText());
           File file =
               Application.getInstance().showFileOpenDialog(MediaResourceView.this, defaultFile);
           if (file != null) filenameField.setText(file.getAbsolutePath());
         }
       });
 }
 @Override
 protected void initUI() {
   super.initUI();
   mediaPanel = new JPanel();
   mediaPanel.setLayout(new BoxLayout(mediaPanel, BoxLayout.Y_AXIS));
   mainPanel.add(mediaPanel);
   //		Box box = Box.createHorizontalBox();
   JPanel filenamePanel = new JPanel(new BorderLayout());
   mediaPanel.add(filenamePanel);
   filenamePanel.add(
       filenameLabel = new JLabel(LanguageBundle.getString("mediaresourceview.filename.label")),
       BorderLayout.WEST);
   filenamePanel.add(filenameField = new JTextField());
   filenamePanel.add(filenameButton = new JButton("..."), BorderLayout.EAST);
   filenamePanel.setMaximumSize(
       new Dimension(
           Integer.MAX_VALUE, filenameField.getPreferredSize().height)); // why is this necesasry?
 }
示例#4
0
 public void setBackground(Drawable background) {
   this.background = background;
   super.setBackground(background);
 }
 @Override
 public void dispose() {
   super.dispose();
 }
 @Override
 public void bindView(ResourceView resourceView, ResourceLookup item) {
   setIcon(resourceView.getImageView(), item.getUri());
   resourceView.setTitle(item.getLabel());
 }