Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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();
}
}

}
45 changes: 17 additions & 28 deletions src/main/java/org/clas/viewer/EventViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
Expand Down Expand Up @@ -308,9 +305,16 @@ public void initSummary() {
JSplitPane splitPanel = new JSplitPane();
splitPanel.setLeftComponent(CLAS12View);
splitPanel.setRightComponent(this.CLAS12Canvas);
JTextPane clas12Text = new JTextPane();
clas12Text.setText("CLAS12\n monitoring plots\n V7.11\n");
clas12Text.setEditable(false);
JTextPane clas12Text = new JTextPane();
clas12Text.setEditable(false);
try {
Properties p = new Properties();
p.load(EventViewer.class.getResourceAsStream("/META-INF/maven/org.clas.detector/clas12mon/pom.properties"));
clas12Text.setText("MON12 v"+p.getProperty("version"));
} catch (IOException ex) {
Logger.getLogger(EventViewer.class.getName()).log(Level.SEVERE, null, ex);
clas12Text.setText("MON12 v?.??\n");
}
this.clas12Textinfo.setEditable(false);
this.clas12Textinfo.setFont(new Font("Avenir",Font.PLAIN,16));
this.clas12Textinfo.setBackground(CLAS12View.getBackground());
Expand All @@ -320,11 +324,12 @@ 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);
CLAS12View.add(this.clas12Textinfo,BorderLayout.BEFORE_FIRST_LINE );
CLAS12View.add(clas12Design);
CLAS12View.add(clas12Text,BorderLayout.PAGE_END);

JLabel clas12Design = Util.getImage("/images/CLAS-frame-high.jpg",0.1);
CLAS12View.add(this.clas12Textinfo,BorderLayout.NORTH );
JPanel x = new JPanel(new BorderLayout());
x.add(clas12Design,BorderLayout.NORTH);
x.add(clas12Text,BorderLayout.SOUTH);
CLAS12View.add(x,BorderLayout.SOUTH);
this.tabbedpane.add(splitPanel,"Summary");
}

Expand Down Expand Up @@ -533,22 +538,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.