Skip to content

Commit 4e1e2a6

Browse files
committed
set text style properly for Contribution Manager error message
1 parent a8cd65f commit 4e1e2a6

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

app/src/processing/app/contrib/ContributionTab.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import javax.swing.*;
3232
import javax.swing.event.*;
33-
import javax.swing.text.*;
3433

3534
import processing.app.*;
3635
import processing.app.ui.Editor;
@@ -200,21 +199,24 @@ protected void buildErrorPanel() {
200199
layout.setAutoCreateGaps(true);
201200
layout.setAutoCreateContainerGaps(true);
202201
errorPanel.setLayout(layout);
203-
// errorPanel.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK));
204202
errorMessage = new JTextPane();
205203
errorMessage.setEditable(false);
206204
errorMessage.setContentType("text/html");
207-
errorMessage.setText("<html><body>Could not connect to the Processing server.<br>"
205+
errorMessage.setText("<html><body><center>Could not connect to the Processing server.<br>"
208206
+ "Contributions cannot be installed or updated without an Internet connection.<br>"
209-
+ "Please verify your network connection again, then try connecting again.</body></html>");
210-
errorMessage.setFont(Toolkit.getSansFont(14, Font.PLAIN));
211-
errorMessage.setMaximumSize(new Dimension(550, 50));
207+
+ "Please verify your network connection again, then try connecting again.</center></body></html>");
208+
DetailPanel.setTextStyle(errorMessage, "1em");
209+
Dimension dim = new Dimension(550, 60);
210+
errorMessage.setMaximumSize(dim);
211+
errorMessage.setMinimumSize(dim);
212212
errorMessage.setOpaque(false);
213213

214+
/*
214215
StyledDocument doc = errorMessage.getStyledDocument();
215216
SimpleAttributeSet center = new SimpleAttributeSet();
216217
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
217218
doc.setParagraphAttributes(0, doc.getLength(), center, false);
219+
*/
218220

219221
closeButton = Toolkit.createIconButton("manager/close");
220222
closeButton.setContentAreaFilled(false);

app/src/processing/app/contrib/DetailPanel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void addPaneComponents() {
167167
margin.bottom = 0;
168168
descriptionPane.setMargin(margin);
169169
descriptionPane.setContentType("text/html");
170-
setTextStyle(descriptionPane);
170+
setTextStyle(descriptionPane, "0.95em");
171171
descriptionPane.setOpaque(false);
172172
if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
173173
descriptionPane.setBackground(new Color(0, 0, 0, 0));
@@ -714,15 +714,15 @@ static void setForegroundStyle(JTextPane textPane,
714714
}
715715

716716

717-
static void setTextStyle(JTextPane textPane) {
717+
static void setTextStyle(JTextPane textPane, String fontSize) {
718718
Document doc = textPane.getDocument();
719719
if (doc instanceof HTMLDocument) {
720720
HTMLDocument html = (HTMLDocument) doc;
721721
StyleSheet stylesheet = html.getStyleSheet();
722722
stylesheet.addRule("body { " +
723723
" margin: 0; padding: 0;" +
724724
" font-family: " + Toolkit.getSansFontName() + ", Arial, Helvetica, sans-serif;" +
725-
" font-size: 100%;" + "font-size: 0.95em; " +
725+
" font-size: 100%;" + "font-size: " + fontSize + "; " +
726726
"}");
727727
}
728728
}

todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
0256 (3.2.4 or 3.3)
2+
X only require reference.zip (and internet connection) when building dist
3+
X set text style properly for Contribution Manager error message
24

35

46
_ fix appbundler problems due to rollback

0 commit comments

Comments
 (0)