Initial upload

Upload my classwork to Github.
This commit is contained in:
didyouexpectthat 2023-06-17 15:15:27 -07:00 committed by GitHub
commit 7d37fcb1d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 359 additions and 0 deletions

BIN
Slide Show/SlideShow.jar Normal file

Binary file not shown.

BIN
Slide Show/SlideShow.zip Normal file

Binary file not shown.

View file

@ -0,0 +1,4 @@
Manifest-Version: 1.0
Main-Class: SlideShow
Class-Path: .

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB

View file

@ -0,0 +1,185 @@
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Color;
public class SlideShow extends JFrame {
/** Edits by Cody Cook on June 3, 2023
* CS-250
*/
private static final long serialVersionUID = 1L;
//Declare Variables
private JPanel slidePane;
private JPanel textPane;
private JPanel buttonPane;
private CardLayout card;
private CardLayout cardText;
private JButton btnPrev;
private JButton btnNext;
private JLabel lblSlide;
private JLabel lblTextArea;
/**
* Create the application.
*/
public SlideShow() throws HeadlessException {
initComponent();
}
/**
* Initialize the contents of the frame.
*/
private void initComponent() {
//Initialize variables to empty objects
card = new CardLayout();
cardText = new CardLayout();
slidePane = new JPanel();
textPane = new JPanel();
textPane.setBackground(Color.BLUE);
textPane.setBounds(5, 470, 790, 50);
textPane.setVisible(true);
buttonPane = new JPanel();
btnPrev = new JButton();
btnNext = new JButton();
lblSlide = new JLabel();
lblTextArea = new JLabel();
//Setup frame attributes
setSize(800, 600);
setLocationRelativeTo(null);
setTitle("Top 5 Detox/Wellness SlideShow"); // 2023/06/03: Update Title to reflex Detox/Wellness
getContentPane().setLayout(new BorderLayout(10, 50));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Setting the layouts for the panels
slidePane.setLayout(card);
textPane.setLayout(cardText);
//logic to add each of the slides and text
for (int i = 1; i <= 5; i++) {
lblSlide = new JLabel();
lblTextArea = new JLabel();
lblSlide.setText(getResizeIcon(i));
lblTextArea.setText(getTextDescription(i));
slidePane.add(lblSlide, "card" + i);
textPane.add(lblTextArea, "cardText" + i);
}
getContentPane().add(slidePane, BorderLayout.CENTER);
getContentPane().add(textPane, BorderLayout.SOUTH);
buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
btnPrev.setText("Previous");
btnPrev.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
goPrevious();
}
});
buttonPane.add(btnPrev);
btnNext.setText("Next");
btnNext.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
goNext();
}
});
buttonPane.add(btnNext);
getContentPane().add(buttonPane, BorderLayout.SOUTH);
}
/**
* Previous Button Functionality
*/
private void goPrevious() {
card.previous(slidePane);
cardText.previous(textPane);
}
/**
* Next Button Functionality
*/
private void goNext() {
card.next(slidePane);
cardText.next(textPane);
}
/**
* Method to get the images
*/
private String getResizeIcon(int i) {
String image = "";
// 2023/06/03: Removed TestImageX.jpg from resources.
if (i==1){
// 2023/06/03: Update TestImage1.jpg to Trip1.jpg; picture collected from https://www.yourgolftravel.com/le-blanc-spa-resort-los-cabos on 6/3; creative commons
image = "<html><body><img width= '800' height='500' src='" + getClass().getResource("/resources/Trip1.jpg") + "'</body></html>";
} else if (i==2){
// 2023/06/03: Update TestImage2.jpg to Trip2.jpg; picture collected from https://www.flickr.com/photos/alainamcbride/6210337494 on 6/3; creative commons license
image = "<html><body><img width= '800' height='500' src='" + getClass().getResource("/resources/Trip2.jpg") + "'</body></html>";
} else if (i==3){
// 2023/06/03: Update TestImage3.jpg to Trip3.jpg; picture collected from https://www.flickr.com/photos/percygermany/32626529922 on 6/3; creative commons license
image = "<html><body><img width= '800' height='500' src='" + getClass().getResource("/resources/Trip3.jpg") + "'</body></html>";
} else if (i==4){
// 2023/06/03: Update TestImage4.jpg to Trip4.jpg; picture collected from https://www.12fly.com.my/lifestyle/en/cleanse-detox-retreats-at-revi%CC%84vo%CC%84-wellness-resort/ on 6/3; creative commons license
image = "<html><body><img width= '800' height='500' src='" + getClass().getResource("/resources/Trip4.jpg") + "'</body></html>";
} else if (i==5){
// 2023/06/03: Update TestImage5.jpg to Trip5.jpg; picture collected from https://www.yourgolftravel.com/barcelo-bavaro-beach-resort on 6/3; creative commons license
image = "<html><body><img width= '800' height='500' src='" + getClass().getResource("/resources/Trip5.jpg") + "'</body></html>";
}
return image;
}
/**
* Method to get the text values
*/
private String getTextDescription(int i) {
String text = "";
if (i==1){
// 2023/06/03: Adjusted #1 to focus on detox/wellness travel
text = "<html><body><font size='5'>#1 Los Cabos Spa Getaway</font><br>Rejuvenate your mind and body at a luxurious wellness spa located in the heart of Los Cabos.</body></html>";
} else if (i==2){
// 2023/06/03: Adjusted #2 to focus on detox/wellness travel; copy tag usage from #1 for description
text = "<html><body><font size='5'>#2 Yoga in Yosemite</font><br>Embark on a serene journey practicing Yoga surrounded by the tranquil beauty of Yosemite.</body></html>";
} else if (i==3){
// 2023/06/03: Adjusted #3 to focus on detox/wellness travel; copy tag usage from #1 for description
text = "<html><body><font size='5'>#3 Berlin Body</font><br>Experience holistic healing and body detox programs in the vibrant city of Berlin.</body></html>";
} else if (i==4){
// 2023/06/03: Adjusted #4 to focus on detox/wellness travel; copy tag usage from #1 for description
text = "<html><body><font size='5'>#4 Peru Purification</font><br>Embark on a purification journey with traditional Incan healing rituals amidst the majestic Andes.</body></html>";
} else if (i==5){
// 2023/06/03: Adjusted #5 to focus on detox/wellness travel; copy tag usage from #1 for description
text = "<html><body><font size='5'>#5 Detox in the Dominican Republic</font><br>Immerse yourself in peaceful coastal retreats offering detox programs in the charming Dominican Republic.</body></html>";
}
return text;
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
SlideShow ss = new SlideShow();
ss.setVisible(true);
}
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB