Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target/
*.png
.DS_Store
Binary file removed images/Screen Shot 2021-06-03 at 17.47.08.png
Binary file not shown.
Binary file removed images/Screen Shot 2021-06-09 at 19.18.04.png
Binary file not shown.
3 changes: 2 additions & 1 deletion src/main/java/org/clas/detectors/Acronyms.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ public Acronyms() {
+ "TDC:\t\tTime to Digital Converter \n"
+ "PMT:\t\tPhoto Multiplier Tube\n"
+ "SiPM:\t\tSilicon Photomultiplier\n");
this.acronymsPanel.add(acronymsDefinitions,BorderLayout.CENTER);
this.acronymsPanel.add(acronymsDefinitions,BorderLayout.WEST);
acronymsDefinitions.setFont(new Font("Avenir",Font.PLAIN,16));
acronymsDefinitions.setEditable(false);
this.acronymsPanel.add(Util.getImage("/images/clas12-design.jpg",0.3),BorderLayout.CENTER);
}

}
27 changes: 27 additions & 0 deletions src/main/java/org/clas/detectors/Util.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.clas.detectors;

import java.awt.Image;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class Util {

public static JLabel getImage(String path, double scale) {
try {
Image image = ImageIO.read(Util.class.getResourceAsStream(path));
ImageIcon imageIcon = new ImageIcon(image);
double width = imageIcon.getIconWidth() * scale;
double height = imageIcon.getIconHeight() * scale;
imageIcon = new ImageIcon(image.getScaledInstance((int) width, (int) height, Image.SCALE_SMOOTH));
return new JLabel(imageIcon);
} catch (Exception ex) {
Logger.getLogger(Util.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("Picture upload from " + path + " failed");
return new JLabel();
}
}

}
18 changes: 1 addition & 17 deletions src/main/java/org/clas/viewer/EventViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void initSummary() {
styledDoc.setParagraphAttributes(0, styledDoc.getLength(), center, false);
clas12Text.setBackground(CLAS12View.getBackground());
clas12Text.setFont(new Font("Avenir",Font.PLAIN,20));
JLabel clas12Design = this.getImage("https://www.jlab.org/Hall-B/clas12-web/sidebar/clas12-design.jpg",0.08);
JLabel clas12Design = Util.getImage("/images/CLAS-frame-high.jpg",0.1);
CLAS12View.add(this.clas12Textinfo,BorderLayout.BEFORE_FIRST_LINE );
CLAS12View.add(clas12Design);
CLAS12View.add(clas12Text,BorderLayout.PAGE_END);
Expand Down Expand Up @@ -533,22 +533,6 @@ public void chooseUpdateInterval() {
}
}
}

private JLabel getImage(String path, double scale) {
Image image = null;
try {
URL url = new URL(path);
image = ImageIO.read(url);
} catch (IOException e) {
e.printStackTrace();
System.out.println("Picture upload from " + path + " failed");
}
ImageIcon imageIcon = new ImageIcon(image);
double width = imageIcon.getIconWidth() * scale;
double height = imageIcon.getIconHeight() * scale;
imageIcon = new ImageIcon(image.getScaledInstance((int) width, (int) height, Image.SCALE_SMOOTH));
return new JLabel(imageIcon);
}

private int getEventNumber(DataEvent event) {
DataBank bank = event.getBank("RUN::config");
Expand Down
File renamed without changes
Binary file removed src/main/resources/jlog.jar
Binary file not shown.