mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Might fix bugs with OS X
This commit is contained in:
@@ -241,6 +241,10 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
|
||||
class StatusRendere extends DefaultTableCellRenderer {
|
||||
|
||||
@Override
|
||||
public void setVerticalAlignment(int alignment) {
|
||||
super.setVerticalAlignment(SwingConstants.CENTER);
|
||||
}
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected,
|
||||
@@ -250,7 +254,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
JLabel label = new JLabel();
|
||||
if (column == 0) {
|
||||
Icon icon = null;
|
||||
label.setBorder(BorderFactory.createEmptyBorder(0, 17, 0, 0));
|
||||
label.setBorder(BorderFactory.createEmptyBorder(2, 17, 0, 0));
|
||||
if (contribution.isInstalled()) {
|
||||
icon = Toolkit.getLibIcon("manager/up-to-date.png");
|
||||
if (contribListing.hasUpdates(contribution)) {
|
||||
@@ -267,6 +271,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
label.setOpaque(true);
|
||||
// return table.getDefaultRenderer(Icon.class).getTableCellRendererComponent(table, icon, isSelected, false, row, column);
|
||||
} else if (column == 1) {
|
||||
//TODO add ellipses, currently the height of JTextPane = height of font + 4
|
||||
JTextPane name = new JTextPane();
|
||||
name.setContentType("text/html");
|
||||
name.setEditable(false);
|
||||
@@ -275,23 +280,32 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
}
|
||||
name.setText("<html><body><b>" + contribution.getName() + "</b> - "
|
||||
+ contribution.getSentence() + "</body></html>");
|
||||
int textHeight = table.getFontMetrics(table.getFont().deriveFont(Font.BOLD)).getHeight() + 4;
|
||||
|
||||
GroupLayout layout = new GroupLayout(label);
|
||||
|
||||
layout.setAutoCreateGaps(true);
|
||||
layout.setHorizontalGroup(layout.createSequentialGroup()
|
||||
.addComponent(name));
|
||||
layout
|
||||
.setVerticalGroup(layout.createParallelGroup().addComponent(name));
|
||||
layout.setVerticalGroup(layout
|
||||
.createSequentialGroup()
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
|
||||
GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(name, 0,
|
||||
textHeight,
|
||||
textHeight)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
|
||||
GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
|
||||
if (table.isRowSelected(row)) {
|
||||
name.setBackground(Color.BLUE);
|
||||
name.setOpaque(true);
|
||||
label.setBackground(Color.BLUE);
|
||||
name.setOpaque(false);
|
||||
}
|
||||
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 00, 0));
|
||||
label.setOpaque(true);
|
||||
label.setLayout(layout);
|
||||
} else {
|
||||
JLabel icon = new JLabel(
|
||||
label = new JLabel(
|
||||
contribution.isSpecial() ? Toolkit
|
||||
.getLibIcon("icons/pde-16.png") : null);
|
||||
JTextPane author = new JTextPane();
|
||||
StringBuilder name = new StringBuilder("");
|
||||
String authorList = contribution.getAuthorList();
|
||||
if (authorList != null) {
|
||||
@@ -310,24 +324,14 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
}
|
||||
}
|
||||
}
|
||||
author.setText(name.toString());
|
||||
author.setEditable(false);
|
||||
author.setOpaque(false);
|
||||
label.setText(name.toString());
|
||||
label.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
if(!contribution.isCompatible(Base.getRevision())){
|
||||
author.setForeground(Color.LIGHT_GRAY);
|
||||
label.setForeground(Color.LIGHT_GRAY);
|
||||
}
|
||||
if (table.isRowSelected(row)) {
|
||||
label.setBackground(Color.BLUE);
|
||||
}
|
||||
GroupLayout layout = new GroupLayout(label);
|
||||
|
||||
// layout.setAutoCreateGaps(true);
|
||||
layout.setHorizontalGroup(layout.createSequentialGroup()
|
||||
.addContainerGap().addComponent(icon).addComponent(author));
|
||||
layout.setVerticalGroup(layout
|
||||
.createParallelGroup(GroupLayout.Alignment.CENTER)
|
||||
.addComponent(author).addComponent(icon));
|
||||
label.setLayout(layout);
|
||||
label.setOpaque(true);
|
||||
}
|
||||
return label;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ContributionManagerDialog {
|
||||
ContributionListing contributionListing = ContributionListing.getInstance();
|
||||
|
||||
public ContributionManagerDialog() {
|
||||
numberLabel = new JLabel();
|
||||
numberLabel = new JLabel(Toolkit.getLibIcon("manager/notification.png"), SwingConstants.CENTER);
|
||||
toolsContributionTab = new ContributionTab(ContributionType.TOOL, this);
|
||||
librariesContributionTab = new ContributionTab(ContributionType.LIBRARY, this);
|
||||
modesContributionTab = new ContributionTab(ContributionType.MODE, this);
|
||||
@@ -146,10 +146,9 @@ public class ContributionManagerDialog {
|
||||
|
||||
|
||||
JPanel updateTabPanel = new JPanel(true);
|
||||
numberLabel.setOpaque(false);
|
||||
numberLabel.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
|
||||
JLabel numberBackground = new JLabel(Toolkit.getLibIcon("manager/notification.png"));
|
||||
JLabel updateTabLabel = new JLabel("Update");
|
||||
numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
|
||||
numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
updateTabPanel.setOpaque(false);
|
||||
updateTabPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
|
||||
.createMatteBorder(0, 2, 0, 0, Color.BLACK), BorderFactory
|
||||
@@ -172,10 +171,10 @@ public class ContributionManagerDialog {
|
||||
updateTabPanel.setLayout(tabLayout);
|
||||
tabLayout.setHorizontalGroup(tabLayout
|
||||
.createSequentialGroup()
|
||||
.addGroup(tabLayout.createParallelGroup().addComponent(numberLabel)
|
||||
.addComponent(numberBackground)).addComponent(updateTabLabel));
|
||||
.addComponent(numberLabel)
|
||||
.addComponent(updateTabLabel));
|
||||
tabLayout.setVerticalGroup(tabLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
|
||||
.addComponent(numberBackground).addComponent(numberLabel)
|
||||
.addComponent(numberLabel)
|
||||
.addComponent(updateTabLabel));
|
||||
|
||||
tabbedPane.addChangeListener(new ChangeListener() {
|
||||
|
||||
Reference in New Issue
Block a user