diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..162a568 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.idea/.name +.idea/compiler.xml +.idea/dictionaries/Bucky.xml +*.iml +.idea/misc.xml +*.xml \ No newline at end of file diff --git a/Android_Beginners/010_States of an Activity/MainActivity.java b/Android_Beginners/010_States of an Activity/MainActivity.java new file mode 100644 index 0000000..9885431 --- /dev/null +++ b/Android_Beginners/010_States of an Activity/MainActivity.java @@ -0,0 +1,97 @@ +package com.apps.gabothekiller.myapplication; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.util.Log; + +public class MainActivity extends ActionBarActivity { + + private static final String TAG = "buckysMessage"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Log.i(TAG, "onCreate"); + } + + @Override + protected void onStart() { + super.onStart(); + Log.i(TAG, "onStart"); + } + + + @Override + protected void onResume() { + super.onResume(); + Log.i(TAG, "onResume"); + } + + + @Override + protected void onPause() { + super.onPause(); + Log.i(TAG, "onPause"); + } + + + @Override + protected void onStop() { + super.onStop(); + Log.i(TAG, "onStop"); + } + + + @Override + protected void onRestart() { + super.onRestart(); + Log.i(TAG, "onRestart"); + } + + + @Override + protected void onDestroy() { + super.onDestroy(); + Log.i(TAG, "onDestroy"); + } + + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + Log.i(TAG, "onSaveInstanceState"); + } + + + @Override + protected void onRestoreInstanceState(Bundle savedInstanceState) { + super.onRestoreInstanceState(savedInstanceState); + Log.i(TAG, "onRestoreInstanceState"); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/Android_Beginners/010_States of an Activity/activity_main.xml b/Android_Beginners/010_States of an Activity/activity_main.xml new file mode 100644 index 0000000..2b1db79 --- /dev/null +++ b/Android_Beginners/010_States of an Activity/activity_main.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/Android_Beginners/021-022_Gestures App/MainActivity.java b/Android_Beginners/021-022_Gestures App/MainActivity.java new file mode 100644 index 0000000..7d6f7ae --- /dev/null +++ b/Android_Beginners/021-022_Gestures App/MainActivity.java @@ -0,0 +1,113 @@ +package com.thenewboston.swiperdiaper; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.TextView; +import android.view.MotionEvent; +import android.view.GestureDetector; +import android.support.v4.view.GestureDetectorCompat; + + +public class MainActivity extends ActionBarActivity implements GestureDetector.OnGestureListener, +GestureDetector.OnDoubleTapListener { + private TextView buckysMessage; + private GestureDetectorCompat gestureDetector; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + buckysMessage = (TextView) findViewById(R.id.buckysMessage); + this.gestureDetector = new GestureDetectorCompat(this, this); + gestureDetector.setOnDoubleTapListener(this); + } + + ///////// GESTURE METHODS ////////// + @Override + public boolean onSingleTapConfirmed(MotionEvent e) { + buckysMessage.setText("onSingleTapConfirmed"); + return true; + } + + @Override + public boolean onDoubleTap(MotionEvent e) { + buckysMessage.setText("onDoubleTap"); + return true; + } + + @Override + public boolean onDoubleTapEvent(MotionEvent e) { + buckysMessage.setText("onDoubleTapEvent"); + return true; + } + + @Override + public boolean onDown(MotionEvent e) { + buckysMessage.setText("onDown"); + return true; + } + + @Override + public void onShowPress(MotionEvent e) { + buckysMessage.setText("onShowPress"); + + } + + @Override + public boolean onSingleTapUp(MotionEvent e) { + buckysMessage.setText("onSingleTapUp"); + return true; + } + + @Override + public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + buckysMessage.setText("onScroll"); + return true; + } + + @Override + public void onLongPress(MotionEvent e) { + buckysMessage.setText("onLongPress"); + + } + + @Override + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + buckysMessage.setText("onFling"); + return true; + } + + ///////// GESTURE METHODS ////////// + + + @Override + public boolean onTouchEvent(MotionEvent event) { + this.gestureDetector.onTouchEvent(event); + return super.onTouchEvent(event); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/Android_Beginners/021-022_Gestures App/activity_main.xml b/Android_Beginners/021-022_Gestures App/activity_main.xml new file mode 100644 index 0000000..7da4044 --- /dev/null +++ b/Android_Beginners/021-022_Gestures App/activity_main.xml @@ -0,0 +1,16 @@ + + + + diff --git a/Android_Beginners/023-030_DankMeme/java/BottomPictureFragment.java b/Android_Beginners/023-030_DankMeme/java/BottomPictureFragment.java new file mode 100644 index 0000000..ad9ce47 --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/java/BottomPictureFragment.java @@ -0,0 +1,30 @@ +package aybars.arslan.fragments; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + + +public class BottomPictureFragment extends Fragment { + + private static TextView txtTop; + private static TextView txtBottom; + + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.bottom_picture_fragment, container, false); + txtTop = (TextView)view.findViewById(R.id.txtTop); + txtBottom = (TextView)view.findViewById(R.id.txtBottom); + return view; + } + + public void setClickedText(String top, String bottom){ + txtTop.setText(top); + txtBottom.setText(bottom); + } + +} diff --git a/Android_Beginners/023-030_DankMeme/java/MainActivity.java b/Android_Beginners/023-030_DankMeme/java/MainActivity.java new file mode 100644 index 0000000..34d0fad --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/java/MainActivity.java @@ -0,0 +1,47 @@ +package aybars.arslan.fragments; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + + +public class MainActivity extends ActionBarActivity implements TopSectionFragment.TopSectionListener { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + //This code called by the Top Fragment called when the user clicked the button + @Override + public void createClick(String top, String bottom) { + BottomPictureFragment bottomFragment = (BottomPictureFragment)getSupportFragmentManager().findFragmentById(R.id.fragment2); + bottomFragment.setClickedText(top, bottom); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + +} diff --git a/Android_Beginners/023-030_DankMeme/java/TopSectionFragment.java b/Android_Beginners/023-030_DankMeme/java/TopSectionFragment.java new file mode 100644 index 0000000..59cabae --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/java/TopSectionFragment.java @@ -0,0 +1,60 @@ +package aybars.arslan.fragments; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.app.Activity; +import android.widget.Button; +import android.widget.EditText; + +public class TopSectionFragment extends Fragment { + + private static EditText etTopTextInput; + private static EditText etBottomTextInput; + + TopSectionListener activityCommander; + + public interface TopSectionListener{ + public void createClick(String top, String bottom); + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + try{ + activityCommander = (TopSectionListener) activity; + }catch (ClassCastException e){ + throw new ClassCastException(activity.toString()); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.top_section_fragment, container, false); + + etTopTextInput = (EditText)view. findViewById(R.id.etTopTextInput); + etBottomTextInput = (EditText)view.findViewById(R.id.etBottomTextInput); + + final Button button = (Button)view.findViewById(R.id.btn); + + button.setOnClickListener( + new View.OnClickListener(){ + + @Override + public void onClick(View v) { + buttonClicked(v); + } + } + ); + + return view; + } + + //Calls this when button clicked + public void buttonClicked(View view){ + activityCommander.createClick(etTopTextInput.getText().toString(), etBottomTextInput.getText().toString()); + } +} diff --git a/Android_Beginners/023-030_DankMeme/res/activity_main.xml b/Android_Beginners/023-030_DankMeme/res/activity_main.xml new file mode 100644 index 0000000..f425ba4 --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/res/activity_main.xml @@ -0,0 +1,29 @@ + + + + + + + diff --git a/Android_Beginners/023-030_DankMeme/res/bottom_picture_fragment.xml b/Android_Beginners/023-030_DankMeme/res/bottom_picture_fragment.xml new file mode 100644 index 0000000..bf21d65 --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/res/bottom_picture_fragment.xml @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file diff --git a/Android_Beginners/023-030_DankMeme/res/top_section_fragment.xml b/Android_Beginners/023-030_DankMeme/res/top_section_fragment.xml new file mode 100644 index 0000000..046d2d0 --- /dev/null +++ b/Android_Beginners/023-030_DankMeme/res/top_section_fragment.xml @@ -0,0 +1,32 @@ + + + + + + + + + THENEWBOSTON + + + + + + + + + + \ No newline at end of file diff --git a/Bootstrap/009_wells.html b/Bootstrap/009_wells.html new file mode 100644 index 0000000..f578e8d --- /dev/null +++ b/Bootstrap/009_wells.html @@ -0,0 +1,39 @@ + + + + thenewboston + + + + + + + + +
+ +

Wells are sections with border and grey background

+ +
Basic Well
+
Small Well
+ +
+ Congratulations, you just won the game! +
+ + +
+ × + Don't forget Kelly's birthday is today! +
+ + +
+ × + Are you sure you want to delete your account? +
+ +
+ + + \ No newline at end of file diff --git a/Bootstrap/012_differentDeviceLayouts.html b/Bootstrap/012_differentDeviceLayouts.html new file mode 100644 index 0000000..9de2a47 --- /dev/null +++ b/Bootstrap/012_differentDeviceLayouts.html @@ -0,0 +1,66 @@ + + + + thenewboston + + + + + + + + +
+ + +

Entire with on larger devices, 1/2 on small ones

+
+
+

Curabitur tellus diam, pharetra quis libero sit amet, finibus suscipit diam. Etiam felis dui, fermentum in est congue, tempus efficitur enim. Donec vitae venenatis neque, vel commodo ipsum. Etiam quis tellus tortor. Morbi porttitor tempor mauris in facilisis. Aliquam eget sapien consequat, finibus lectus nec, pulvinar justo. Mauris in consectetur lacus, in luctus turpis. Aenean eget velit ipsum. Sed elit enim, ullamcorper ac orci ac, fringilla interdum est. Praesent nec nisi ultrices lorem ullamcorper congue. Vivamus sed gravida metus, ut auctor nisl. Aliquam sollicitudin fringilla justo id facilisis.

+
+
+ + +

Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop

+
+
+
1/3 desktop, 1/2 mobile
+
1/3 desktop, 1/2 mobile
+
1/3 desktop, 1/2 mobile
+
+
+ + +

Offsetting Columns

+
+
4 wide
+
+
+
4 wide offset 2
+
+ + +

Nested Rows

+
+
+ + I am the main parent + + +
+
+ child 1 +
+
+ child 2 +
+
+ +
+
+ + +
+ + + \ No newline at end of file diff --git a/Bootstrap/013_pushAndPull.html b/Bootstrap/013_pushAndPull.html new file mode 100644 index 0000000..2834142 --- /dev/null +++ b/Bootstrap/013_pushAndPull.html @@ -0,0 +1,40 @@ + + + + thenewboston + + + + + + + + +
+ +

Push and pull

+ +
+ + +
+ Content A - MAIN BANNER +
+ + +
+ Content B +
+ +
+ Content C +
+ +
+
+ + + \ No newline at end of file diff --git a/Bootstrap/014_loginModal.html b/Bootstrap/014_loginModal.html new file mode 100644 index 0000000..ec53018 --- /dev/null +++ b/Bootstrap/014_loginModal.html @@ -0,0 +1,54 @@ + + + + thenewboston + + + + + + + + +
+ +

Log In Demo

+ + + + + + +
+ + + \ No newline at end of file diff --git a/Bootstrap/landing/index.html b/Bootstrap/landing/index.html new file mode 100644 index 0000000..2e979f7 --- /dev/null +++ b/Bootstrap/landing/index.html @@ -0,0 +1,144 @@ + + + + thenewboston + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+

Welcome to thenewboston

+

Social Network for Programmers

+
+ +
+
+ +
+
+
+ + + +
+
+
+ +
+
+ + +
+ +

Write and Drink Tea with Sweaters

+

+ A special thanks to Death to the Stock Photo for providing the photographs that + you see in this template. Visit their website to become a member. +

+
+ +
+ +
+ +
+
+
+ + + +
+
+
+ +
+
+
+

This Girl is Hot

+

+ A special thanks to Death to the Stock Photo for providing the photographs that + you see in this template. Visit their website to become a member. +

+
+ +
+ +
+ +
+ +
+
+ + + \ No newline at end of file diff --git a/Bootstrap/landing/landing.css b/Bootstrap/landing/landing.css new file mode 100644 index 0000000..ca8e102 --- /dev/null +++ b/Bootstrap/landing/landing.css @@ -0,0 +1,110 @@ +body, +html { + width: 100%; + height: 100%; +} + +body, +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: 'Droid Sans', sans-serif; + font-weight: bold; +} + +.topnav { + font-size: 14px; +} + +/* Have padding top so banner image doesn't overlap top nav */ +.intro-banner { + padding-top: 50px; + padding-bottom: 50px; + text-align: center; + color: #f2f2f2; + background: url("wood.jpg") no-repeat center center; + background-size: cover; +} + +.intro-inner { + position: relative; + padding-top: 20%; + padding-bottom: 20%; +} + +.intro-inner > h1 { + margin: 0; + text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6); + font-size: 5em; +} + +.intro-divider { + width: 400px; + border-top: 1px solid #f2f2f2; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); +} + +.intro-inner > h3 { + text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6); +} + +/* Special paragraphs that stand out */ +.lead { + font-size: 20px; +} + +/* For smaller devices */ +@media (max-width: 767px) { + .intro-inner { + padding-bottom: 15%; + } + + .intro-inner > h1 { + font-size: 3em; + } + + ul.intro-social-buttons > li { + display: block; + margin-bottom: 20px; + padding: 0; + } + + ul.intro-social-buttons > li:last-child { + margin-bottom: 0; + } + + .intro-divider { + width: 100%; + } +} + +.button-title { + font-family: 'Architects Daughter', cursive; + font-size: 18px; +} + +.content-section-a { + padding: 50px 0; + background-color: #f2f2f2; +} + +.content-section-b { + padding: 50px 0; + border-top: 1px solid #e3e3e3; + border-bottom: 1px solid #e3e3e3; +} + +/* hr */ +.section-heading-spacer { + float: left; + width: 200px; + border-top: 3px solid #e3e3e3; +} + +/* Little paragraph snippet sections */ +.section-heading { + margin-bottom: 30px; +} diff --git a/Bootstrap/landing/wood.jpg b/Bootstrap/landing/wood.jpg new file mode 100644 index 0000000..43a4f94 Binary files /dev/null and b/Bootstrap/landing/wood.jpg differ diff --git a/Bootstrap/sidebar/index.html b/Bootstrap/sidebar/index.html new file mode 100644 index 0000000..5a0c1ea --- /dev/null +++ b/Bootstrap/sidebar/index.html @@ -0,0 +1,74 @@ + + + + thenewboston + + + + + + + + + +
+ + + + + +
+
+
+
+ Toggle Menu +

Sidebar Layouts are Cool

+

I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie.

+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bootstrap/sidebar/sidebar.css b/Bootstrap/sidebar/sidebar.css new file mode 100644 index 0000000..405f906 --- /dev/null +++ b/Bootstrap/sidebar/sidebar.css @@ -0,0 +1,52 @@ +/* Sidebar */ +#sidebar-wrapper { + z-index: 1; + position: absolute; + width: 0; + height: 100%; + overflow-y: hidden; + background: #2C3E50; + border: 2px solid red; + opacity: 0.9; +} + +/* Always take up entire screen */ +#page-content-wrapper { + width: 100%; + position: absolute; + padding: 15px; + border: 5px solid blue; +} + + +/* Change with of sidebar from 0 to 250px */ +#wrapper.menuDisplayed #sidebar-wrapper { + width: 250px; +} + +/* Since we added left padding, we need to shrink the width by 250px */ +#wrapper.menuDisplayed #page-content-wrapper { + padding-left: 250px; +} + + +/* Sidebar styling - the entire ul list */ +.sidebar-nav { + padding: 0; + list-style: none; +} + +.sidebar-nav li { + text-indent: 20px; + line-height: 40px; +} + +.sidebar-nav li a { + display: block; + text-decoration: none; + color: #ddd; +} + +.sidebar-nav li a:hover { + background: #16A085; +} diff --git a/C++/42_cppBeginners.cpp b/C++/42_cppBeginners.cpp new file mode 100644 index 0000000..043548e --- /dev/null +++ b/C++/42_cppBeginners.cpp @@ -0,0 +1,38 @@ +//This is Sally.h file +#ifndef SALLY_H +#define SALLY_H + +class Sally +{ + public: + Sally(); + void printCrap(); + protected: + private: +}; +#endif // SALLY_H + +//This is Sally.cpp file +#include "Sally.h" +#include +using namespace std; + +Sally::Sally() +{ +} +void Sally::printCrap(){ + cout<< "did someone say steak?"< +#include "Sally.h" +using namespace std; + +int main(){ + Sally sallyObject; + Sally *sallyPointer = &sallyObject; + + sallyObject.printCrap(); + sallyPointer->printCrap(); +} \ No newline at end of file diff --git a/C++/43_cppBeginners.cpp b/C++/43_cppBeginners.cpp new file mode 100644 index 0000000..f2f8c4b --- /dev/null +++ b/C++/43_cppBeginners.cpp @@ -0,0 +1,39 @@ +//This is Sally.h file +#ifndef SALLY_H +#define SALLY_H + +class Sally +{ + public: + Sally(); + ~Sally(); + protected: + private: +}; +#endif // SALLY_H + +//This is Sally.cpp file +#include "Sally.h" +#include +using namespace std; + +Sally::Sally() +{ + cout<< "i am the constructor" << endl; +} + +Sally::~Sally() +{ + cout<< "i am the deconstructor" << endl; +} + +//This is main.cpp file +#include +#include "Sally.h" +using namespace std; + +int main(){ + + Sally so; + cout << "omg wtf is this on my shoe? "< +using namespace std; + +Sally::Sally() +{ +} + +void Sally::printShiz() +{ + cout << "i am a regular function"< +#include "Sally.h" +using namespace std; + +int main(){ + Sally salObj; + salObj.printShiz(); + + const Sally constObj; + constObj.printShiz2(); +} \ No newline at end of file diff --git a/C++/45_cppBeginners.cpp b/C++/45_cppBeginners.cpp new file mode 100644 index 0000000..fe95650 --- /dev/null +++ b/C++/45_cppBeginners.cpp @@ -0,0 +1,40 @@ +//This is Sally.h file +#ifndef SALLY_H +#define SALLY_H + +class Sally +{ + public: + Sally(int a,int b); + void print(); + private: + int regVar; + const int constVar; +}; + +#endif //SALLY_H + +//This is Sally.cpp file +#include "Sally.h" +#include +using namespace std; + +Sally::Sally(int a,int b) +:regVar(a), +constVar(b) +{ +} + +void Sally::print(){ + cout << "regular var is: " << regVar << "const varible is :" << constVar < +#include "Sally.h" +using namespace std; + +int main() +{ + Sally so(3,87); + so.print(); +} \ No newline at end of file diff --git a/C++/46_&47_cppBeginners.cpp b/C++/46_&47_cppBeginners.cpp new file mode 100644 index 0000000..88c2839 --- /dev/null +++ b/C++/46_&47_cppBeginners.cpp @@ -0,0 +1,82 @@ +//This is Birthday.h file +#ifndef BIRTHDAY_H +#define BIRTHDAY_H + +class Birthday +{ + public: + Birthday(int m, int d,int y); + void printDate(); + private: + int month; + int day; + int year; +}; + +#endif // BIRTHDAY_H + +//This is Birthday.cpp file +#include "Birthday.h" +#include +using namespace std; + +Birthday::Birthday(int m, int d, int y) +{ + month = m; + day = d; + year = y; +} + +void Birthday::printDate(){ + cout << month << "/" << day << "/" << year < +#include "Birthday.h" +using namespace std; + +class People +{ + public: + People(string x,Birthday bo); + void printInfo(); + private: + string name; + Birthday dataOfBirth; +}; + +#endif // PEOPLE_H + +//This is People.cpp file +#include "People.h" +#include "Birthday.h" +#include +using namespace std; + +People::People(String x,Birthday bo) +: name(x), dataOfBirth(bo) +{ +} + +void People::printInfo(){ + cout << name << "was born on"; + dataOfBirth.printDate(); +} +//This is main.cpp file +#include +#include "Birthday.h" +#include "People.h" +using namespace std; + +int main() +{ + Birthday birthObj(12,28,1986); + + People buckyRoberts("Bucky the King",birthObj); + buckyRoberts.printInfo(); + +} \ No newline at end of file diff --git a/C++/48_cppBeginners.cpp b/C++/48_cppBeginners.cpp new file mode 100644 index 0000000..fc7a5e5 --- /dev/null +++ b/C++/48_cppBeginners.cpp @@ -0,0 +1,25 @@ +//This is main.cpp file +#include +using namespace std; + +class StankFist{ + public: + StankFist()(stinkyVar=0;) + private: + int stinkyVar; + + friend void stinkysFriend(StankFist &sfo); +}; + +void stinkysFriend(StankFist &sfo) +{ + sfo.stinkyVar=99; + cout << sfo.stinkyVar < +#include "Hannah.h" +using namespace std; + +Hannah::Hannah(int num) +:h(num) +{ +} + +void Hannah::printCrap(){ + cout << "h=" << h <h=" << this->h < +#include "Sally.h" +using namespace std; + +Sally::Sally() +{ +} + +Sally::Sally(int a){ + num = a; +} +Sally Sally::operator+(Sally aso){ + Sally brandNew; + brandNew.num = num + aso.num; + return(brandNew); +} +//This is main.cpp file +#include +#include "Sally.h" +using namespace std; + +int main() +{ + Sally a(34); + Sally b(21); + Sally c; + c=a+b; + cout << c.num << endl; + +} diff --git a/C++/52_cppBeginners.cpp b/C++/52_cppBeginners.cpp new file mode 100644 index 0000000..607d974 --- /dev/null +++ b/C++/52_cppBeginners.cpp @@ -0,0 +1,59 @@ +//This is Mother.h file +#ifndef MOTHER_H +#define MOTHER_H + +class Mother +{ + public: + Mother(); + void sayName(); +}; + +#endif // MOTHER_H + +//This is Mother.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +Mother::Mother() +{ +} + +void Mother::sayName(){ + cout << "I am a RobnertsQ" << endl; +} + +//This is Daughter.h file +#ifndef DAUGHTER_H +#define DAUGHTER_H + +class Daughter: public Mother +{ + public: + Daughter(); +}; + +#endif // DAUGHTER_H + +//This is Daughter.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +Daughter::Daughter() +{ +} +//This is main.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +int main(){ + + Daughter tina; + tina.sayName(); +} diff --git a/C++/53_cppBeginners.cpp b/C++/53_cppBeginners.cpp new file mode 100644 index 0000000..73a0401 --- /dev/null +++ b/C++/53_cppBeginners.cpp @@ -0,0 +1,57 @@ +//This is Mother.h file +#ifndef MOTHER_H +#define MOTHER_H + +class Mother +{ + public: + int publicv; + protected: + int protectedv; + private: + int privatev; +}; + +#endif // MOTHER_H + +//This is Mother.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +//This is Daughter.h file +#ifndef DAUGHTER_H +#define DAUGHTER_H + +class Daughter: public Mother +{ + public: + void dosomething(); +}; + +#endif // DAUGHTER_H + +//This is Daughter.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +void Daughter::dosomething() +{ + publicv = 1; + protected = 2; +} +//This is main.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +int main(){ + + Daughter tina; + tina.dosomething(); +} + \ No newline at end of file diff --git a/C++/54_cppBeginners.cpp b/C++/54_cppBeginners.cpp new file mode 100644 index 0000000..e6d825f --- /dev/null +++ b/C++/54_cppBeginners.cpp @@ -0,0 +1,62 @@ +//This is Mother.h file +#ifndef MOTHER_H +#define MOTHER_H + +class Mother +{ + public: + Mother(); + ~Mother(); +}; + +#endif // MOTHER_H + +//This is Mother.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +Mother::Mother(){ + cout<< "I am the mother constructor!" << endl; +} + +Mother::~Mother(){ + cout<< "mother deconstructor!" << endl; +} +//This is Daughter.h file +#ifndef DAUGHTER_H +#define DAUGHTER_H + +class Daughter: public Mother +{ + public: + Daughter(); + ~Daughter(); +}; + +#endif // DAUGHTER_H + +//This is Daughter.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +void Daughter::dosomething() +{ + publicv = 1; + protected = 2; +} +//This is main.cpp file +#include +#include "Mother.h" +#include "Daughter.h" +using namespace std; + +int main(){ + + Daughter tina; + +} + \ No newline at end of file diff --git a/C++/55_cppBeginners.cpp b/C++/55_cppBeginners.cpp new file mode 100644 index 0000000..768f059 --- /dev/null +++ b/C++/55_cppBeginners.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +class Enemy{ + protected: + int attackPower; + public: + void setAttackPower(int a){ + attackPower=a; + } +}; +class Ninja: public Enemy{ + public: + void attack() + {cout << "i am a ninja, ninja chop! -" << attackPower <setAttackPower(29); + enemy2->setAttackPower(99); + n.attack(); + m.attack(); +} diff --git a/C++/56_cppBeginners.cpp b/C++/56_cppBeginners.cpp new file mode 100644 index 0000000..be5d70d --- /dev/null +++ b/C++/56_cppBeginners.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; + +class Enemy{ + public: + virtual void attack(){} + +}; +class Ninja: public Enemy{ + public: + void attack() + {cout << "ninja attack!" <attack(); + enemy2->attack(); + +} diff --git a/C++/57_cppBeginners.cpp b/C++/57_cppBeginners.cpp new file mode 100644 index 0000000..53a3423 --- /dev/null +++ b/C++/57_cppBeginners.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; + +class Enemy{ + public: + virtual void attack()=0; + +}; +class Ninja: public Enemy{ + public: + void attack() + {cout << "ninja attack!" <attack(); + enemy2->attack(); + +} diff --git a/C++/58_cppBeginners.cpp b/C++/58_cppBeginners.cpp new file mode 100644 index 0000000..56c30e8 --- /dev/null +++ b/C++/58_cppBeginners.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; + +template +bucky addCrap(bucky a, bucky b) +{ +return a+b; +} + +int main() +{ + int x=7, y=43,z; + z=addCrap(x,y); + cout << z < +using namespace std; + +template + +FIRST smaller(FIRST a, SECOND b) +{ +return (a +using namespace std; + +template +class Bucky{ + T first, second; + public: + Bucky(T a, T b) + { + first=a; + second=b; + } + T bigger(); +}; +template +T Bucky::bigger() +{ +return (first>second?first:second); +} + +int main() +{ + Bucky bo(258, 105); + cout << bo.bigger(); +} \ No newline at end of file diff --git a/C++/61_cppBeginners.cpp b/C++/61_cppBeginners.cpp new file mode 100644 index 0000000..c7e8b46 --- /dev/null +++ b/C++/61_cppBeginners.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +template +class Spunky{ + public: + Spunky(T x) + { + cout << x << " is not a character!" << endl; + } +}; +template <> +class Spunky{ + public: + Spunky(char x) + { + cout << x << " is needed character!" << endl; + } +}; +int main() +{ + Spunky obj1(7; + Spunky obj2(3.154); + Spunky obj3('q'); + +} \ No newline at end of file diff --git a/C++/62_cppBeginners.cpp b/C++/62_cppBeginners.cpp new file mode 100644 index 0000000..5e9c928 --- /dev/null +++ b/C++/62_cppBeginners.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + +int main() +{ + try{ + int momsAge = 30; + int sonsAge = 34; + + if(sonsAge > momsAge) + { + throw 99; + } + }catch(int x); + cout << "son can not be older than mom ERROR NUMBER :" << x << endl; + } + +} diff --git a/C++/63_cppBeginners.cpp b/C++/63_cppBeginners.cpp new file mode 100644 index 0000000..179045a --- /dev/null +++ b/C++/63_cppBeginners.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; + +int main() +{ + try { + + int num1; + cout << "Enter first number :" << endl; + cin>> num1; + + int num2; + cout << "Enter second number :" << endl; + cin>> num2; + + if(num2 == 0){ + throw 0; + + } + + cout << num1/num2 << endl; + }catch(int x){ + cout << "you cant divide by 0" << x << endl; + } +} \ No newline at end of file diff --git a/C++/64_cppBeginners.cpp b/C++/64_cppBeginners.cpp new file mode 100644 index 0000000..f392790 --- /dev/null +++ b/C++/64_cppBeginners.cpp @@ -0,0 +1,12 @@ +#include +#include +using namespace std; + +int main() +{ + ofstream buckyFile; + buckyFile.open("tuna.txt"); + + buckyFile << "I love tuna and tuna loves me!\n"; + buckyFile.close(); +} \ No newline at end of file diff --git a/C++/65_cppBeginners.cpp b/C++/65_cppBeginners.cpp new file mode 100644 index 0000000..c3fef9f --- /dev/null +++ b/C++/65_cppBeginners.cpp @@ -0,0 +1,17 @@ +#include +#include +using namespace std; + +int main() +{ + ofstream buckysFile("beefjerky.txt"); + + if(buckysFile.is_open()){ + cout << "okt he file is open" < +#include +using namespace std; + +int main() +{ + ofstream theFile("players.txt"); + + cout << "Enter palyers ID, Name, and Money" << endl; + cout << "press Ctrl+Z to quit\n" <> idNumber >> name >> money) + { + theFile < +#include +using namespace std; + +int main() +{ + ifstream theFile("players.txt"); + + int idNumber; + string name; + double money; + + while(theFile >> idNumber >> name >> money) + { + cout < +#include +using namespace std; + +int getWhatTheyWant(); + +//main function + +int main(){ + + int whatTheyWant; + + whatTheyWant = getWhatTheyWant(); + + while(whatTheyWant != 4){ + + whatTheyWant = getWhatTheyWant(); + } +} + +//getWhatTheyWant function +int getWhatTheyWant(){ + int choice; + + cout << "1 - just plain items" <> choice; + return choice; + +} \ No newline at end of file diff --git a/C++/69_cppBeginners.cpp b/C++/69_cppBeginners.cpp new file mode 100644 index 0000000..1926b37 --- /dev/null +++ b/C++/69_cppBeginners.cpp @@ -0,0 +1,76 @@ +#include +#include +using namespace std; + +int getWhatTheyWant(); +void displayItems(int x); + +//main function +int main(){ + + int whatTheyWant; + + whatTheyWant = getWhatTheyWant(); + + while(whatTheyWant != 4){ + switch(whatTheyWant){ + case 1: + displayItems(1); + break; + case 2: + displayItems(2); + break; + case 3: + displayItems(3); + break; + } + + whatTheyWant = getWhatTheyWant(); + } +} + +//getWhatTheyWant function +int getWhatTheyWant(){ + int choice; + + cout << "1 - just plain items" <> choice; + return choice; + +} + +//display items function +void displayItems(int x){ + + ifstream objectFile("objects.txt"); + string name; + double power; + + if(x==1){ + while(objectFile >> name >> power){ + if(power==0){ + cout << name << ' ' << power << endl; + } + } +} + if(x==2){ + while(objectFile >> name >> power){ + if(power>0){ + cout << name << ' ' << power << endl; + } + } +} + + if(x==3){ + while(objectFile >> name >> power){ + if(power<0){ + cout << name << ' ' << power << endl; + } + } + } + +} \ No newline at end of file diff --git a/C++/70_cppBeginners.cpp b/C++/70_cppBeginners.cpp new file mode 100644 index 0000000..4582e34 --- /dev/null +++ b/C++/70_cppBeginners.cpp @@ -0,0 +1,76 @@ +#include +#include +using namespace std; + +int getWhatTheyWant(); +void displayItems(int x); + +//main function +int main(){ + + int whatTheyWant; + + whatTheyWant = getWhatTheyWant(); + + while(whatTheyWant != 4){ + switch(whatTheyWant){ + case 1: + displayItems(1); + break; + case 2: + displayItems(2); + break; + case 3: + displayItems(3); + break; + } + + whatTheyWant = getWhatTheyWant(); + } +} + +//getWhatTheyWant function +int getWhatTheyWant(){ + int choice; + + cout << "\n1 - just plain items" <> choice; + return choice; + +} + +//display items function +void displayItems(int x){ + + ifstream objectFile("objects.txt"); + string name; + double power; + + if(x==1){ + while(objectFile >> name >> power){ + if(power==0){ + cout << name << ' ' << power << endl; + } + } +} + if(x==2){ + while(objectFile >> name >> power){ + if(power>0){ + cout << name << ' ' << power << endl; + } + } +} + + if(x==3){ + while(objectFile >> name >> power){ + if(power<0){ + cout << name << ' ' << power << endl; + } + } + } + +} \ No newline at end of file diff --git a/Foundation/001_template.html b/Foundation/001_template.html new file mode 100644 index 0000000..6aaca74 --- /dev/null +++ b/Foundation/001_template.html @@ -0,0 +1,28 @@ + + + + + + + + thenewboston + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Foundation/002_gridSystem.html b/Foundation/002_gridSystem.html new file mode 100644 index 0000000..2709243 --- /dev/null +++ b/Foundation/002_gridSystem.html @@ -0,0 +1,35 @@ + + + + + + + + thenewboston + + + + + + + +
+
4
+
6
+
2
+
+ +
+
6
+
6
+
+ + + + + + \ No newline at end of file diff --git a/Foundation/003_dynamicLayouts.html b/Foundation/003_dynamicLayouts.html new file mode 100644 index 0000000..86127ee --- /dev/null +++ b/Foundation/003_dynamicLayouts.html @@ -0,0 +1,37 @@ + + + + + + + + thenewboston + + + + + + + + + +
+ +
Left
+
Right
+ +
+ + + + + + diff --git a/Foundation/004_blockGrid.html b/Foundation/004_blockGrid.html new file mode 100644 index 0000000..7149e2d --- /dev/null +++ b/Foundation/004_blockGrid.html @@ -0,0 +1,40 @@ + + + + + + + + thenewboston + + + + + + + + +
+ +
    +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
+ +
+ + + + + + diff --git a/Foundation/005_typography.html b/Foundation/005_typography.html new file mode 100644 index 0000000..8951345 --- /dev/null +++ b/Foundation/005_typography.html @@ -0,0 +1,48 @@ + + + + + + + + thenewboston + + + + + + + + +
+
+ + + +
+ This is how you make quotes. + Bucky Roberts +
+ +

Labels

+

Hey can you go to the store and pickup cream cheese?

+ +

Keystrokes

+

To make your browser faster type Alt + F4

+ +
+
+ + + + + + diff --git a/Foundation/006_offCanvasSideMenu.html b/Foundation/006_offCanvasSideMenu.html new file mode 100644 index 0000000..9cf9785 --- /dev/null +++ b/Foundation/006_offCanvasSideMenu.html @@ -0,0 +1,68 @@ + + + + + + + + thenewboston + + + + + + + + +
+
+ + + Toggle Menu + + + + + +
+
Hey now dude
+
This is some sample content
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/Foundation/007_dualToggleMenuLayout.html b/Foundation/007_dualToggleMenuLayout.html new file mode 100644 index 0000000..390839c --- /dev/null +++ b/Foundation/007_dualToggleMenuLayout.html @@ -0,0 +1,69 @@ + + + + + + + + thenewboston + + + + + + + + +
+
+ + + + + + + + + + + +
+

Bacon ipsum dolor amet pancetta prosciutto ball tip tri-tip tail salami. Tenderloin tongue ham leberkas. Filet mignon boudin doner kielbasa turducken flank ground round ham porchetta brisket t-bone alcatra venison jowl pastrami. Jerky prosciutto drumstick, ham hock beef hamburger brisket fatback alcatra pork belly rump. Shoulder frankfurter t-bone meatball, pork loin rump picanha.

+

Bacon ipsum dolor amet pancetta prosciutto ball tip tri-tip tail salami. Tenderloin tongue ham leberkas. Filet mignon boudin doner kielbasa turducken flank ground round ham porchetta brisket t-bone alcatra venison jowl pastrami. Jerky prosciutto drumstick, ham hock beef hamburger brisket fatback alcatra pork belly rump. Shoulder frankfurter t-bone meatball, pork loin rump picanha.

+

Bacon ipsum dolor amet pancetta prosciutto ball tip tri-tip tail salami. Tenderloin tongue ham leberkas. Filet mignon boudin doner kielbasa turducken flank ground round ham porchetta brisket t-bone alcatra venison jowl pastrami. Jerky prosciutto drumstick, ham hock beef hamburger brisket fatback alcatra pork belly rump. Shoulder frankfurter t-bone meatball, pork loin rump picanha.

+
+ + + +
+
+ + + + + + diff --git a/Foundation/008_topNavigationBar.html b/Foundation/008_topNavigationBar.html new file mode 100644 index 0000000..542830a --- /dev/null +++ b/Foundation/008_topNavigationBar.html @@ -0,0 +1,61 @@ + + + + + + + + thenewboston + + + + + + + + + + + + + + + diff --git a/Foundation/009_topNavSearchAndLeftMenu.html b/Foundation/009_topNavSearchAndLeftMenu.html new file mode 100644 index 0000000..7cb5513 --- /dev/null +++ b/Foundation/009_topNavSearchAndLeftMenu.html @@ -0,0 +1,40 @@ + + + + + + + + thenewboston + + + + + + + + +
+ + + +
Right side
+ +
+ + + + + + diff --git a/Foundation/010_breadcrumbsAndAlerts.html b/Foundation/010_breadcrumbsAndAlerts.html new file mode 100644 index 0000000..3f2847c --- /dev/null +++ b/Foundation/010_breadcrumbsAndAlerts.html @@ -0,0 +1,55 @@ + + + + + + + + thenewboston + + + + + + + + +
+
+ + + + +
+ Your message has been sent! + × +
+ + +
+ New high score! + × +
+ + +
+ Don't send nude pics to you ex! + × +
+ +
+
+ + + + + + diff --git a/Grunt/Gruntfile.js b/Grunt/Gruntfile.js new file mode 100644 index 0000000..825d730 --- /dev/null +++ b/Grunt/Gruntfile.js @@ -0,0 +1,29 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + + pkg: grunt.file.readJSON('package.json'), + cssmin: { + combine: { + files: { + 'html/css/main.css': ['html/css/content.css', 'html/css/sidebar.css'] + } + } + }, + uglify: { + dist: { + files: { + 'html/js/toggle.min.js': ['html/js/toggle.js'] + } + } + } + }); + + // Load the plugins + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + + // Do the tasks + grunt.registerTask('default', ['cssmin', 'uglify']); + +}; \ No newline at end of file diff --git a/Grunt/html/css/content.css b/Grunt/html/css/content.css new file mode 100644 index 0000000..eebd888 --- /dev/null +++ b/Grunt/html/css/content.css @@ -0,0 +1,9 @@ +h1{ + color: lightseagreen; + font-size: 36px; +} + +p{ + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 20px; +} \ No newline at end of file diff --git a/Grunt/html/css/sidebar.css b/Grunt/html/css/sidebar.css new file mode 100644 index 0000000..318696e --- /dev/null +++ b/Grunt/html/css/sidebar.css @@ -0,0 +1,47 @@ +/* Sidebar */ +#sidebar-wrapper{ + z-index: 1; + position: absolute; + width: 0; + height: 100%; + overflow-y: hidden; + background: #2C3E50; +} + +/* Always take up entire screen */ +#page-content-wrapper{ + width: 100%; + position: absolute; + padding: 15px; +} + +/* Change with of sidebar from 0 to 250px */ +#wrapper.menuDisplayed #sidebar-wrapper{ + width: 250px; +} + +/* Since we added left padding, we need to shrink the width by 250px */ +#wrapper.menuDisplayed #page-content-wrapper{ + padding-left: 250px; +} + +/* Sidebar styling - the entire ul list */ +.sidebar-nav{ + padding: 0; + list-style: none; +} + +.sidebar-nav li{ + text-indent: 20px; + line-height: 40px; +} + +.sidebar-nav li a{ + display: block; + text-decoration: none; + color: #ddd; +} + +.sidebar-nav li a:hover{ + background: #16A085; +} \ No newline at end of file diff --git a/Grunt/html/index.html b/Grunt/html/index.html new file mode 100644 index 0000000..8f1cc65 --- /dev/null +++ b/Grunt/html/index.html @@ -0,0 +1,48 @@ + + + + thenewboston + + + + + + + + + +
+ + + + + +
+
+
+
+ Toggle Menu +

Welcome to thenewboston

+

I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie. + I love apple pie. I love apple pie. I love apple pie. I love apple pie. I love apple pie.

+
+
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/Grunt/html/js/toggle.js b/Grunt/html/js/toggle.js new file mode 100644 index 0000000..5d2cae4 --- /dev/null +++ b/Grunt/html/js/toggle.js @@ -0,0 +1,12 @@ +$("#menu-toggle").click( function (e){ + e.preventDefault(); + $("#wrapper").toggleClass("menuDisplayed"); +}); + + +// This is just worthless JavaScript for demo purposes +var x = myFunction(4, 3); + +function myFunction(a, b) { + return a * b; +} \ No newline at end of file diff --git a/Grunt/package.json b/Grunt/package.json new file mode 100644 index 0000000..1742a91 --- /dev/null +++ b/Grunt/package.json @@ -0,0 +1,14 @@ +{ + "name": "bacon", + "version": "1.0.0", + "description": "Website about bacon", + "main": "index.html", + "author": "Bucky Roberts", + "devDependencies": { + "grunt": "^0.4.5", + "grunt-contrib-cssmin": "^0.12.3", + "grunt-contrib-less": "^1.0.1", + "grunt-contrib-uglify": "^0.9.1", + "grunt-contrib-watch": "^0.6.1" + } +} diff --git a/JavaFX/000_template/Main.java b/JavaFX/000_template/Main.java index d1dbbb2..1a2661c 100644 --- a/JavaFX/000_template/Main.java +++ b/JavaFX/000_template/Main.java @@ -16,10 +16,8 @@ public static void main(String[] args) { @Override public void start(Stage primaryStage) throws Exception { window = primaryStage; - window.setTitle("Title of the Window"); - - button = new Button(); - button.setText("Click me"); + window.setTitle("thenewboston - JavaFX"); + button = new Button("Click me"); StackPane layout = new StackPane(); layout.getChildren().add(button); diff --git a/JavaFX/009_gridPane/Main.java b/JavaFX/009_gridPane/Main.java new file mode 100644 index 0000000..c3a77aa --- /dev/null +++ b/JavaFX/009_gridPane/Main.java @@ -0,0 +1,59 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //GridPane with 10px padding around edge + GridPane grid = new GridPane(); + grid.setPadding(new Insets(10, 10, 10, 10)); + grid.setVgap(8); + grid.setHgap(10); + + //Name Label - constrains use (child, column, row) + Label nameLabel = new Label("Username:"); + GridPane.setConstraints(nameLabel, 0, 0); + + //Name Input + TextField nameInput = new TextField("Bucky"); + GridPane.setConstraints(nameInput, 1, 0); + + //Password Label + Label passLabel = new Label("Password:"); + GridPane.setConstraints(passLabel, 0, 1); + + //Password Input + TextField passInput = new TextField(); + passInput.setPromptText("password"); + GridPane.setConstraints(passInput, 1, 1); + + //Login + Button loginButton = new Button("Log In"); + GridPane.setConstraints(loginButton, 1, 2); + + //Add everything to grid + grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton); + + Scene scene = new Scene(grid, 300, 200); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/010_extractAndValidateInput/Main.java b/JavaFX/010_extractAndValidateInput/Main.java new file mode 100644 index 0000000..01e5712 --- /dev/null +++ b/JavaFX/010_extractAndValidateInput/Main.java @@ -0,0 +1,53 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TextField; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Scene scene; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + //Form + TextField ageInput = new TextField(); + + button = new Button("Click me"); + button.setOnAction( e -> isInt(ageInput, ageInput.getText()) ); + + //Layout + VBox layout = new VBox(10); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(ageInput, button); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + //Validate age + private boolean isInt(TextField input, String message){ + try{ + int age = Integer.parseInt(input.getText()); + System.out.println("User is: " + age); + return true; + }catch(NumberFormatException e){ + System.out.println("Error: " + message + " is not a number"); + return false; + } + } + + +} \ No newline at end of file diff --git a/JavaFX/011_checkBoxes/Main.java b/JavaFX/011_checkBoxes/Main.java new file mode 100644 index 0000000..c299fa1 --- /dev/null +++ b/JavaFX/011_checkBoxes/Main.java @@ -0,0 +1,57 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Scene scene; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("Bucky's Meat Subs"); + + //Checkboxes + CheckBox box1 = new CheckBox(); + CheckBox box2 = new CheckBox("Tuna"); + box2.setSelected(true); + + //Button + button = new Button("Order Now!"); + button.setOnAction(e -> handleOptions(box1, box2)); + + //Layout + VBox layout = new VBox(10); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(box1, box2, button); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + //Handle checkbox options + private void handleOptions(CheckBox box1, CheckBox box2){ + String message = "Users order:\n"; + + if(box1.isSelected()) + message += "Bacon\n"; + + if(box2.isSelected()) + message += "Tuna\n"; + + System.out.println(message); + } + + +} \ No newline at end of file diff --git a/JavaFX/012_choiceBoxDropDownList/Main.java b/JavaFX/012_choiceBoxDropDownList/Main.java new file mode 100644 index 0000000..98d701d --- /dev/null +++ b/JavaFX/012_choiceBoxDropDownList/Main.java @@ -0,0 +1,53 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ChoiceBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Scene scene; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("ChoiceBox Demo"); + button = new Button("Click me"); + + ChoiceBox choiceBox = new ChoiceBox<>(); + + //getItems returns the ObservableList object which you can add items to + choiceBox.getItems().add("Apples"); + choiceBox.getItems().add("Bananas"); + choiceBox.getItems().addAll("Bacon", "Ham", "Meatballs"); + + //Set a default value + choiceBox.setValue("Apples"); + + button.setOnAction(e -> getChoice(choiceBox)); + + VBox layout = new VBox(10); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(choiceBox, button); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + //To get the value of the selected item + private void getChoice(ChoiceBox choiceBox){ + String food = choiceBox.getValue(); + System.out.println(food); + } + + +} \ No newline at end of file diff --git a/JavaFX/013_comboBox/Main.java b/JavaFX/013_comboBox/Main.java new file mode 100644 index 0000000..edf43cc --- /dev/null +++ b/JavaFX/013_comboBox/Main.java @@ -0,0 +1,53 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Scene scene; + Button button; + ComboBox comboBox; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("ComboBox Demo"); + button = new Button("Submit"); + + comboBox = new ComboBox<>(); + comboBox.getItems().addAll( + "Good Will Hunting", + "St. Vincent", + "Blackhat" + ); + + comboBox.setPromptText("What is your favorite movie?"); + button.setOnAction(e -> printMovie()); + + //ComboBoxes also generate actions if you need to get value instantly + comboBox.setOnAction( e -> System.out.println("User selected " + comboBox.getValue()) ); + + VBox layout = new VBox(10); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(comboBox, button); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + private void printMovie(){ + System.out.println(comboBox.getValue()); + } + + +} \ No newline at end of file diff --git a/JavaFX/015_listViews/Main.java b/JavaFX/015_listViews/Main.java new file mode 100644 index 0000000..20d3643 --- /dev/null +++ b/JavaFX/015_listViews/Main.java @@ -0,0 +1,55 @@ +import javafx.application.Application; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.SelectionMode; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; +import javafx.scene.control.ListView; + +public class Main extends Application { + + Stage window; + Scene scene; + Button button; + ListView listView; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("ListView Demo"); + button = new Button("Submit"); + + listView = new ListView<>(); + listView.getItems().addAll("Iron Man", "Titanic", "Contact", "Surrogates"); + listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); + + button.setOnAction(e -> buttonClicked()); + + VBox layout = new VBox(10); + layout.setPadding(new Insets(20, 20, 20, 20)); + layout.getChildren().addAll(listView, button); + + scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + private void buttonClicked(){ + String message = ""; + ObservableList movies; + movies = listView.getSelectionModel().getSelectedItems(); + + for(String m: movies) + message += m + "\n"; + + System.out.println(message); + } + + +} \ No newline at end of file diff --git a/JavaFX/016_treeView/Main.java b/JavaFX/016_treeView/Main.java new file mode 100644 index 0000000..cf414e3 --- /dev/null +++ b/JavaFX/016_treeView/Main.java @@ -0,0 +1,65 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + TreeView tree; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) { + window = primaryStage; + window.setTitle("JavaFX - thenewboston"); + + TreeItem root, bucky, megan; + + //Root + root = new TreeItem<>(); + root.setExpanded(true); + + //Bucky + bucky = makeBranch("Bucky", root); + makeBranch("thenewboston", bucky); + makeBranch("YouTube", bucky); + makeBranch("Chicken", bucky); + + //Megan + megan = makeBranch("Megan", root); + makeBranch("Glitter", megan); + makeBranch("Makeup", megan); + + //Create the tree and hide the main Root + tree = new TreeView<>(root); + tree.setShowRoot(false); + tree.getSelectionModel().selectedItemProperty() + .addListener((v, oldValue, newValue) -> { + if (newValue != null) + System.out.println(newValue.getValue()); + }); + + //Layout + StackPane layout = new StackPane(); + layout.getChildren().add(tree); + Scene scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + //Create branches + public TreeItem makeBranch(String title, TreeItem parent) { + TreeItem item = new TreeItem<>(title); + item.setExpanded(true); + parent.getChildren().add(item); + return item; + } + + +} \ No newline at end of file diff --git a/JavaFX/018_tableView/Main.java b/JavaFX/018_tableView/Main.java new file mode 100644 index 0000000..2b25235 --- /dev/null +++ b/JavaFX/018_tableView/Main.java @@ -0,0 +1,68 @@ +import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + TableView table; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //Name column + TableColumn nameColumn = new TableColumn<>("Name"); + nameColumn.setMinWidth(200); + nameColumn.setCellValueFactory(new PropertyValueFactory<>("name")); + + //Price column + TableColumn priceColumn = new TableColumn<>("Price"); + priceColumn.setMinWidth(100); + priceColumn.setCellValueFactory(new PropertyValueFactory<>("price")); + + //Quantity column + TableColumn quantityColumn = new TableColumn<>("Quantity"); + quantityColumn.setMinWidth(100); + quantityColumn.setCellValueFactory(new PropertyValueFactory<>("quantity")); + + table = new TableView<>(); + table.setItems(getProduct()); + table.getColumns().addAll(nameColumn, priceColumn, quantityColumn); + + VBox vBox = new VBox(); + vBox.getChildren().addAll(table); + + Scene scene = new Scene(vBox); + window.setScene(scene); + window.show(); + } + + //Get all of the products + public ObservableList getProduct(){ + ObservableList products = FXCollections.observableArrayList(); + products.add(new Product("Laptop", 859.00, 20)); + products.add(new Product("Bouncy Ball", 2.49, 198)); + products.add(new Product("Toilet", 99.00, 74)); + products.add(new Product("The Notebook DVD", 19.99, 12)); + products.add(new Product("Corn", 1.49, 856)); + return products; + } + + +} \ No newline at end of file diff --git a/JavaFX/018_tableView/Product.java b/JavaFX/018_tableView/Product.java new file mode 100644 index 0000000..4c1be5d --- /dev/null +++ b/JavaFX/018_tableView/Product.java @@ -0,0 +1,43 @@ +public class Product { + + private String name; + private double price; + private int quantity; + + public Product(){ + this.name = ""; + this.price = 0; + this.quantity = 0; + } + + public Product(String name, double price, int quantity){ + this.name = name; + this.price = price; + this.quantity = quantity; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + +} \ No newline at end of file diff --git a/JavaFX/020_tableViewAddingAndDeleting/Main.java b/JavaFX/020_tableViewAddingAndDeleting/Main.java new file mode 100644 index 0000000..b33dc8e --- /dev/null +++ b/JavaFX/020_tableViewAddingAndDeleting/Main.java @@ -0,0 +1,114 @@ +import javafx.application.Application; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.control.TextField; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + TableView table; + TextField nameInput, priceInput, quantityInput; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //Name column + TableColumn nameColumn = new TableColumn<>("Name"); + nameColumn.setMinWidth(200); + nameColumn.setCellValueFactory(new PropertyValueFactory<>("name")); + + //Price column + TableColumn priceColumn = new TableColumn<>("Price"); + priceColumn.setMinWidth(100); + priceColumn.setCellValueFactory(new PropertyValueFactory<>("price")); + + //Quantity column + TableColumn quantityColumn = new TableColumn<>("Quantity"); + quantityColumn.setMinWidth(100); + quantityColumn.setCellValueFactory(new PropertyValueFactory<>("quantity")); + + //Name input + nameInput = new TextField(); + nameInput.setPromptText("Name"); + nameInput.setMinWidth(100); + + //Price input + priceInput = new TextField(); + priceInput.setPromptText("Price"); + + //Quantity input + quantityInput = new TextField(); + quantityInput.setPromptText("Quantity"); + + //Button + Button addButton = new Button("Add"); + addButton.setOnAction(e -> addButtonClicked()); + Button deleteButton = new Button("Delete"); + deleteButton.setOnAction(e -> deleteButtonClicked()); + + HBox hBox = new HBox(); + hBox.setPadding(new Insets(10,10,10,10)); + hBox.setSpacing(10); + hBox.getChildren().addAll(nameInput, priceInput, quantityInput, addButton, deleteButton); + + table = new TableView<>(); + table.setItems(getProduct()); + table.getColumns().addAll(nameColumn, priceColumn, quantityColumn); + + VBox vBox = new VBox(); + vBox.getChildren().addAll(table, hBox); + + Scene scene = new Scene(vBox); + window.setScene(scene); + window.show(); + } + + //Add button clicked + public void addButtonClicked(){ + Product product = new Product(); + product.setName(nameInput.getText()); + product.setPrice(Double.parseDouble(priceInput.getText())); + product.setQuantity(Integer.parseInt(quantityInput.getText())); + table.getItems().add(product); + nameInput.clear(); + priceInput.clear(); + quantityInput.clear(); + } + + //Delete button clicked + public void deleteButtonClicked(){ + ObservableList productSelected, allProducts; + allProducts = table.getItems(); + productSelected = table.getSelectionModel().getSelectedItems(); + + productSelected.forEach(allProducts::remove); + } + + //Get all of the products + public ObservableList getProduct(){ + ObservableList products = FXCollections.observableArrayList(); + products.add(new Product("Laptop", 859.00, 20)); + products.add(new Product("Bouncy Ball", 2.49, 198)); + products.add(new Product("Toilet", 99.00, 74)); + products.add(new Product("The Notebook DVD", 19.99, 12)); + products.add(new Product("Corn", 1.49, 856)); + return products; + } + + +} \ No newline at end of file diff --git a/JavaFX/020_tableViewAddingAndDeleting/Product.java b/JavaFX/020_tableViewAddingAndDeleting/Product.java new file mode 100644 index 0000000..4c1be5d --- /dev/null +++ b/JavaFX/020_tableViewAddingAndDeleting/Product.java @@ -0,0 +1,43 @@ +public class Product { + + private String name; + private double price; + private int quantity; + + public Product(){ + this.name = ""; + this.price = 0; + this.quantity = 0; + } + + public Product(String name, double price, int quantity){ + this.name = name; + this.price = price; + this.quantity = quantity; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + +} \ No newline at end of file diff --git a/JavaFX/024_menus/Main.java b/JavaFX/024_menus/Main.java new file mode 100644 index 0000000..c1ea6ef --- /dev/null +++ b/JavaFX/024_menus/Main.java @@ -0,0 +1,81 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.*; +import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + BorderPane layout; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + //File menu + Menu fileMenu = new Menu("File"); + MenuItem newFile = new MenuItem("New..."); + newFile.setOnAction(e -> System.out.println("Create a new file...")); + fileMenu.getItems().add(newFile); + fileMenu.getItems().add(new MenuItem("Open...")); + fileMenu.getItems().add(new MenuItem("Save...")); + fileMenu.getItems().add(new SeparatorMenuItem()); + fileMenu.getItems().add(new MenuItem("Settings...")); + fileMenu.getItems().add(new SeparatorMenuItem()); + fileMenu.getItems().add(new MenuItem("Exit...")); + + //Edit menu + Menu editMenu = new Menu("_Edit"); + editMenu.getItems().add(new MenuItem("Cut")); + editMenu.getItems().add(new MenuItem("Copy")); + MenuItem paste = new MenuItem("Paste"); + paste.setOnAction(e -> System.out.println("Pasting some crap")); + paste.setDisable(true); + editMenu.getItems().add(paste); + + //Help menu + Menu helpMenu = new Menu("Help"); + CheckMenuItem showLines = new CheckMenuItem("Show Line Numbers"); + showLines.setOnAction(e -> { + if(showLines.isSelected()) + System.out.println("Program will now display line numbers"); + else + System.out.println("Hiding line number"); + }); + CheckMenuItem autoSave = new CheckMenuItem("Enable Autosave"); + autoSave.setSelected(true); + helpMenu.getItems().addAll(showLines, autoSave); + + //Difficulty RadioMenuItems + Menu difficultyMenu = new Menu("Difficulty"); + ToggleGroup difficultyToggle = new ToggleGroup(); + + RadioMenuItem easy = new RadioMenuItem("Easy"); + RadioMenuItem medium = new RadioMenuItem("Medium"); + RadioMenuItem hard = new RadioMenuItem("Hard"); + + easy.setToggleGroup(difficultyToggle); + medium.setToggleGroup(difficultyToggle); + hard.setToggleGroup(difficultyToggle); + + difficultyMenu.getItems().addAll(easy, medium, hard); + + //Main menu bar + MenuBar menuBar = new MenuBar(); + menuBar.getMenus().addAll(fileMenu, editMenu, helpMenu, difficultyMenu); + + layout = new BorderPane(); + layout.setTop(menuBar); + Scene scene = new Scene(layout, 400, 300); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/027_css/Main.java b/JavaFX/027_css/Main.java new file mode 100644 index 0000000..99d9af4 --- /dev/null +++ b/JavaFX/027_css/Main.java @@ -0,0 +1,66 @@ +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston - JavaFX"); + + //GridPane with 10px padding around edge + GridPane grid = new GridPane(); + grid.setPadding(new Insets(10, 10, 10, 10)); + grid.setVgap(8); + grid.setHgap(10); + + //Name Label - constrains use (child, column, row) + Label nameLabel = new Label("Username:"); + nameLabel.setId("bold-label"); + GridPane.setConstraints(nameLabel, 0, 0); + + //Name Input + TextField nameInput = new TextField("Bucky"); + GridPane.setConstraints(nameInput, 1, 0); + + //Password Label + Label passLabel = new Label("Password:"); + GridPane.setConstraints(passLabel, 0, 1); + + //Password Input + TextField passInput = new TextField(); + passInput.setPromptText("password"); + GridPane.setConstraints(passInput, 1, 1); + + //Login + Button loginButton = new Button("Log In"); + GridPane.setConstraints(loginButton, 1, 2); + + //Sign up + Button signUpButton = new Button("Sign Up"); + signUpButton.getStyleClass().add("button-blue"); + GridPane.setConstraints(signUpButton, 1, 3); + + //Add everything to grid + grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, signUpButton); + + Scene scene = new Scene(grid, 300, 200); + scene.getStylesheets().add("Viper.css"); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/027_css/Viper.css b/JavaFX/027_css/Viper.css new file mode 100644 index 0000000..6b7af6c --- /dev/null +++ b/JavaFX/027_css/Viper.css @@ -0,0 +1,19 @@ +.root{ + -fx-background-color: #383838; +} +.label{ + -fx-text-fill: #e8e8e8; +} +.button{ + -fx-background-color: #AB4642; + -fx-text-fill: #FFFFFF; + -fx-background-radius: 4; +} +.button-blue{ + -fx-background-color: #7cafc2; + -fx-text-fill: #FFFFFF; + -fx-background-radius: 4; +} +#bold-label{ + -fx-font-weight: bold; +} \ No newline at end of file diff --git a/JavaFX/028_properties/Main.java b/JavaFX/028_properties/Main.java new file mode 100644 index 0000000..821d424 --- /dev/null +++ b/JavaFX/028_properties/Main.java @@ -0,0 +1,40 @@ +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + Person bucky = new Person(); + + bucky.firstNameProperty().addListener( (v, oldValue, newValue) -> { + System.out.println("Name changed to " + newValue); + System.out.println("firstNameProperty(): " + bucky.firstNameProperty()); + System.out.println("getFirstName(): " + bucky.getFirstName()); + }); + + button = new Button("Submit"); + button.setOnAction(e -> bucky.setFirstName("Porky")); + + StackPane layout = new StackPane(); + layout.getChildren().add(button); + Scene scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/028_properties/Person.java b/JavaFX/028_properties/Person.java new file mode 100644 index 0000000..962be7e --- /dev/null +++ b/JavaFX/028_properties/Person.java @@ -0,0 +1,24 @@ +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; + +public class Person { + + private StringProperty firstName = new SimpleStringProperty(this, "firstName", ""); + + //Returns the StringProperty object + public StringProperty firstNameProperty() { + return firstName; + } + + //Return the firstName value (ie. "Bucky") + public String getFirstName() { + return firstName.get(); + } + + //Set the firstName value + public void setFirstName(String firstName) { + this.firstName.set(firstName); + } + + +} diff --git a/JavaFX/029_binding/Main.java b/JavaFX/029_binding/Main.java new file mode 100644 index 0000000..678cdad --- /dev/null +++ b/JavaFX/029_binding/Main.java @@ -0,0 +1,44 @@ +import javafx.application.Application; +import javafx.beans.property.IntegerProperty; +import javafx.beans.property.SimpleIntegerProperty; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + Button button; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + IntegerProperty x = new SimpleIntegerProperty(3); + IntegerProperty y = new SimpleIntegerProperty(); + + y.bind(x.multiply(10)); + System.out.println("x: " + x.getValue()); + System.out.println("y: " + y.getValue() + "\n"); + + x.setValue(9); + System.out.println("x: " + x.getValue()); + System.out.println("y: " + y.getValue() + "\n"); + + button = new Button("Submit"); + + StackPane layout = new StackPane(); + layout.getChildren().add(button); + Scene scene = new Scene(layout, 300, 250); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/030_bindingPropertiesExample/Main.java b/JavaFX/030_bindingPropertiesExample/Main.java new file mode 100644 index 0000000..cb7c858 --- /dev/null +++ b/JavaFX/030_bindingPropertiesExample/Main.java @@ -0,0 +1,42 @@ +import javafx.application.Application; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class Main extends Application { + + Stage window; + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + window = primaryStage; + window.setTitle("thenewboston"); + + //Input and labels + TextField userInput = new TextField(); + userInput.setMaxWidth(200); + Label firstLabel = new Label("Welcome to the site "); + Label secondLabel = new Label(); + + HBox bottomText = new HBox(firstLabel, secondLabel); + bottomText.setAlignment(Pos.CENTER); + VBox vBox = new VBox(10, userInput, bottomText); + vBox.setAlignment(Pos.CENTER); + + secondLabel.textProperty().bind(userInput.textProperty()); + + Scene scene = new Scene(vBox, 300, 200); + window.setScene(scene); + window.show(); + } + + +} \ No newline at end of file diff --git a/JavaFX/031_fxml/Controller.java b/JavaFX/031_fxml/Controller.java new file mode 100644 index 0000000..0f4bd6a --- /dev/null +++ b/JavaFX/031_fxml/Controller.java @@ -0,0 +1,14 @@ +package sample; + +import javafx.fxml.Initializable; +import java.net.URL; +import java.util.ResourceBundle; + +public class Controller implements Initializable { + + @Override + public void initialize(URL location, ResourceBundle resources) { + System.out.println("View is now loaded!"); + } + +} \ No newline at end of file diff --git a/JavaFX/031_fxml/Main.java b/JavaFX/031_fxml/Main.java new file mode 100644 index 0000000..d8f4a43 --- /dev/null +++ b/JavaFX/031_fxml/Main.java @@ -0,0 +1,24 @@ +package sample; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +public class Main extends Application { + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception{ + Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); + primaryStage.setTitle("Hello World"); + primaryStage.setScene(new Scene(root, 300, 275)); + primaryStage.show(); + } + + +} diff --git a/JavaFX/031_fxml/sample.fxml b/JavaFX/031_fxml/sample.fxml new file mode 100644 index 0000000..46a7463 --- /dev/null +++ b/JavaFX/031_fxml/sample.fxml @@ -0,0 +1,11 @@ + + + + + + +